2 things would be the possible causes of slowness.
1. You did not give much detail except for "macro in Excel", so I assume the code runs in Excel VBA to automate AutoCAD as external application. This means the code execution needs to communication back and forth between 2 applications (Excel and AutoCAD). That is, each instruction from Excel to let AutoCAD do something, data must pass through application boundaries, thus the slowness. If the code driving AutoCAD to do something runs inside AutoCAD (AutoCAD VBA), it would be a lot faster (10, 20 times, maybe).
In your case, if Excel's involvement is only providing data for block's attributes/dynamic properties, it would be much better to run the code from AutoCAD VBA side: read all data from Excel at one shot, then go through the blocks in AutoCAD.
2. You also did not say what editing dynamic block means, but if it means editing block's dynamic properties, yes, it would slow down AutoCAD significantly: each time a dynamic property changes, it is likely that AutoCAD has to define a new anonymous block definition accordingly. In your case, AutoCAD could be end up creating 4000 new block definitions. I am not certain what AutoCAD does this behind the scene, but I could imagine AutoCAD may search the existing anonymous block definitions for this dynamic block to find matched one for particular dynamic property value, and only define a new one if no match found. This would take a lots of time if you have 4000 block references to the same dynamic block definition and all or most have different dynamic property values, or worse, the block have too many dynamic properties (a kind of "dynamic block abuse", I'd say).
In you case, if the block has too many dynamic properties and you have too many block references to the same dynamic block definition, it is bound to slow down AutoCAD very much.