Matt Miller
asked on
Referencing Another Tab Based on a Cell Value
Hi I've inherited a spreadsheet with multiple tabs. I am trying to break out the individual columns to individual tabs and then tie it into a backend. I have the macro established to break it out into the individual tabs but am stumped on how to tie the backend into the individual tabs.
I was wondering if there is a way to use a cell value to lead into the appropiate tab for a HLookup?
Thanks.
I was wondering if there is a way to use a cell value to lead into the appropiate tab for a HLookup?
Thanks.
You can refer to a tab indirectly through a cell value using the INDIRECT() function
e.g. if you have a sheet named, MySheet, and you have a cell in the activesheet with text string in it as MySheet, then you can reference that as =INDIRECT("'"&A1&"'!A1:A10 0)
this will refer to sheet shown in cell A1 and look at range A1:A100 in that sheet.
e.g. if you have a sheet named, MySheet, and you have a cell in the activesheet with text string in it as MySheet, then you can reference that as =INDIRECT("'"&A1&"'!A1:A10
this will refer to sheet shown in cell A1 and look at range A1:A100 in that sheet.
ASKER
I think I'm partway there but I'm getting a reference error.
=HLOOKUP(E1,INDIRECT("'"&E 2) & "!$B$1:$AZ$1000",2,0)
=HLOOKUP(E1,INDIRECT("'"&E
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much. This is exactly what I needed.
With If statement, and nested If statements, you can for sure do some sort of selection between which tab is used for the HLookup.
That also said, for sure you can do it in VBA.
What's the rule on which tab to use as the cell value change?