reichertc
Mechanical
- Mar 21, 2001
- 115
OK. I have two worksheets in a workbook, "OSBL" and "OSBLData". The OSBLData sheet is full of information that I retreived from an Access database. Excel automatically refers to the data that Access has provided me by the range name "ExternalData1". I want to lookup information on the OSBL sheet from "ExternalData1". The problem is that my lookupvalue consists of a combination of the data in the first two columns that Access has returned. So, I inserted a column to the left of the data and entered the formula =B2&C2 in cell A2 and copied it down. This gives me my list of unique values that I can then use with the VLOOKUP function. Now my range "ExternalData1" only refers to columns B,C,D... while the values I am looking up are in column A. So I redefine the range "ExternalData1" to include column A.
The reason I did all this was that the "ExternalData1" range will automatically resize every time I refresh the data that is being returned from Access. This is extremely useful for the hundred of formulas I have on the sheet "OSBL".
Does anyone know of a way that I can use VBA to automatically redefine the range one column to the left when I click the refresh data button on the external data toolbar? If this is too much of a pain, how about just a VBA procedure that will do it that I could assign to a button? It's no problem for me to redefine the range, but the other users of the spreadsheet will likely destroy all my work if I ask them to do anything more than click a button...
Thanks in advance,
Chris
The reason I did all this was that the "ExternalData1" range will automatically resize every time I refresh the data that is being returned from Access. This is extremely useful for the hundred of formulas I have on the sheet "OSBL".
Does anyone know of a way that I can use VBA to automatically redefine the range one column to the left when I click the refresh data button on the external data toolbar? If this is too much of a pain, how about just a VBA procedure that will do it that I could assign to a button? It's no problem for me to redefine the range, but the other users of the spreadsheet will likely destroy all my work if I ask them to do anything more than click a button...
Thanks in advance,
Chris