How to stop losing formula when refreshing data

Godders199

Active Member
Joined
Mar 2, 2017
Messages
313
Office Version
  1. 2013
Hello, i have a spreadsheet that refreshes from a database, however everytime i press refresh the $A$1:$AZ$1 is lost

=LEFT(ADDRESS(1,MATCH(A2,checksmart!$A$1:$AZ$1,0)*1,4),2)

After refresh

=LEFT(ADDRESS(1,MATCH(A2,checksmart!#REF!,0)*1,4),2)

I have checked another spreaadsheet that uses the same feed and formula and that works fine, i cannot find any differences. is there any way i can prevent the formula changing when the data is refreshed?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi there:

This may be to do with the way the table is defined. Check the external data properties of your table - set the 'if the number of rows changes on refresh' to 'overwrite existing cells with new data, clear unused cells'.
 
Upvote 0
thanks, this appears to be all the code there is relating to the refresh from the source.
Sheets("Info").Select
Calculate

Qlink = Sheets("Info").Range("A56").Value

Sheets("checkSmart").Select

Range("A1:AZ50000").Select
Selection.Delete Shift:=xlUp

ActiveWorkbook.XmlImport URL:=Qlink, ImportMap:=Nothing, Overwrite:=True, Destination:=Range("$A$1")


do i need to change something?
 
Upvote 0
Ah. It will be the 'Selection.Delete Shift:=xlUp'. This removes all the rows, and so the formula cannot reference them. Replace it with 'Selection.ClearContents' and see what happens.
 
Upvote 0
You're welcome. Would you be kind enough to click on the thanks button for my answer>
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

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