Losing Lookup references when refreshing datatable

Jat999

New Member
Joined
May 7, 2016
Messages
37
Hi All

I am having troubles in trying to maintain references to a SQL datatable.

I have a sheet where the user enters an order number, there is some VBA codes that runs an SQL script to an external database to bring back information to a datatable.
All this works fine.
However there is then, on the user sheet, some vlookups that refer to various fields on the datatable.
My problem is that whenever the SQL database refreshes the datatable, some of the lookups fail with a #REF !.
I have tried creating absolute cell references but this does not work.


Any ideas please - this has been bugging me all evening - tired and needing sleep....

Thanks in advance
John
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Jat999

New Member
Joined
May 7, 2016
Messages
37
Apologies - in my post above I refer to vlookups. I actually mean I am referencing cells directly on the data table and getting the errors.

i did mention I was tired....
 

Fazza

MrExcel MVP
Joined
May 17, 2006
Messages
9,352
hello, John

Try giving the datatable a simple defined name, and have the lookups reference/use that name (instead of what I assume is currently a range reference like 'Sheet1'!A1:Z999)

HTH. regards, Fazza
 

Jat999

New Member
Joined
May 7, 2016
Messages
37
Re: Losing Lookup references when refreshing datatable - Solved

Solved

Using Index function.
 

Watch MrExcel Video

Forum statistics

Threads
1,099,699
Messages
5,470,241
Members
406,686
Latest member
BNR_ 1980

This Week's Hot Topics

Top