#REF Error After Macro

geospatial

Active Member
Joined
Sep 2, 2008
Messages
290
I have a dynamic range, but after running a macro I end up getting a #REF error. My dynamic range before the formula looks like this =offset(Master!$A$2,0,0,counta(Master!$A:$A),1), and then after the macro it is =offset(Master!#REF!,0,0,counta(Master!#REF),1). The macro ran fine with no problems, but not sure how to keep it from doing this every time.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
It does, but then it adds new data back in. Everyday we have about 500 new records, but then there are also some that are added or changed from previous weeks. The easiest way I thought of to keep my sheet updated was to do a macro that removes everything and then reimports all the data again.
 
Upvote 0
The easiest fix is to change your dynamic range formula to
=offset(Master!$A$1,1,0,counta(Master!$A:$A),1)
 
Upvote 0
Try using:

=INDEX(Master!$A:$A,2):INDEX(Master!$A:$A,COUNTA(Master!$A:$A))

or clear the contents of A2 rather than deleting it.
 
Upvote 0
I will give both a shot. Thanks to both of you. I was either going to try that or to maybe do a macro that creates a temporary dynamic range while running the macro
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,881
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top