Solved

Referencing Another Tab Based on a Cell Value

Posted on 2013-11-08
6
209 Views
Last Modified: 2013-11-08
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.
0
Comment
Question by:mattfmiller
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 12

Expert Comment

by:Harry Lee
ID: 39634211
It really depends on what cell value you are referring to.

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?
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39634216
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:A100)

this will refer to sheet shown in cell A1 and look at range A1:A100 in that sheet.
0
 
LVL 1

Author Comment

by:mattfmiller
ID: 39634298
I think I'm partway there but I'm getting a reference error.

=HLOOKUP(E1,INDIRECT("'"&E2) & "!$B$1:$AZ$1000",2,0)
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 23

Accepted Solution

by:
NBVC earned 225 total points
ID: 39634335
Try:

=HLOOKUP(E1,INDIRECT("'"&E2&"'!$B$1:$AZ$1000"),2,0)
0
 
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 225 total points
ID: 39634340
Try

=HLOOKUP(E1,INDIRECT("'"&E2 & "'!$B$1:$AZ$1000"),2,0)
0
 
LVL 1

Author Closing Comment

by:mattfmiller
ID: 39634358
Thank you very much.  This is exactly what I needed.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question