Wednesday, November 14, 2018

Dynamic Range Selection in Macros code


In Excel we all face the issue while recording the macro, that the range selected is always a set.

So whenever there are changes in the rows like if added or removed then it should adjust automatically.

Here is the solution:

Let the list range in the recorded code is set as "A1:D15". 

Change it to Range("A1").CurrentRegion, so the range will automatically adjust, if rows are added or removed.

No comments:

Post a Comment