Solved

Referencing Another Tab Based on a Cell Value

Posted on 2013-11-08
6
190 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
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

776 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