ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to reference a worksheet which name is specified in a cell (https://www.excelbanter.com/excel-programming/344795-how-reference-worksheet-name-specified-cell.html)

pimar[_4_]

How to reference a worksheet which name is specified in a cell
 

Hi all,
I'm trying to reference a worksheet which name is specified in a cell.
Example:

assuming that cells A1 and A2 contain the name of my sheets :

A1 Sheet A
A2 Sheet B

in cell C1 I need to get a value from "Sheet A", like ='Sheet A"!X1,
while in C2 I'd like to have ='Sheet B'!X1
but I'd like to get bthe name of sheets from cell A1 and A2,

something like

C1 ='$A$1'!X1
C2 ='$A$2'!X1

Which is the right sintax?

Thanks in advance
*pimar


--
pimar
------------------------------------------------------------------------
pimar's Profile: http://www.excelforum.com/member.php...fo&userid=5386
View this thread: http://www.excelforum.com/showthread...hreadid=482383


Walt[_3_]

How to reference a worksheet which name is specified in a cell
 
Hi pimar,

I think this is what you want:

A
1 Sheet A
2 Sheet B
3 =INDIRECT("'"&A1&"'"&"!X1")
4 =INDIRECT("'"&A2&"'"&"!X1")

The apostrophes within the double quotes allow for sheet names with
spaces.
No visual basic programming required.

Best Regards,
Walt Weber



All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com