ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using contents of cell to refer to a worksheet (https://www.excelbanter.com/excel-programming/277747-using-contents-cell-refer-worksheet.html)

Mike[_50_]

Using contents of cell to refer to a worksheet
 
I have worksheets that I would like to reference in
formulas using cells containing the worksheet names. How
do I use cell contents as the names worksheets in
formulas? For example, assume I have 12 worksheets
titled January, February, March, etc. And in a 13th
worksheet I have a column containing the values January
or February or March etc. If I want to use that column
to refer to cells in one of the 12 worksheets, how do I
use those cell contents as the worksheet name in the
actual formula? There must be some syntax that allows me
to do that.

Tumbleweed

Using contents of cell to refer to a worksheet
 
=SheetName!CellAddress
examples:
=January!A1
=February!B47
=March!D3


"Mike" wrote in message
...
I have worksheets that I would like to reference in
formulas using cells containing the worksheet names. How
do I use cell contents as the names worksheets in
formulas? For example, assume I have 12 worksheets
titled January, February, March, etc. And in a 13th
worksheet I have a column containing the values January
or February or March etc. If I want to use that column
to refer to cells in one of the 12 worksheets, how do I
use those cell contents as the worksheet name in the
actual formula? There must be some syntax that allows me
to do that.




Mike E

Using contents of cell to refer to a worksheet
 
To clarify, I am referring to the use of cell contents as the worksheet
name, not the exact name itself. So in call A1 I have the contents
"January". I need to know how to use A1 (the contents therein) as the
name of the worksheet.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tumbleweed

Using contents of cell to refer to a worksheet
 
Tried to work out what you're describing, in a formula before I posted, but
didn't have any luck
Here is a VBA method that builds the formula.

Sub HeadingInFormula()

Dim sHdColTwo As String
Dim sHdColThree As String
Dim sHdColFour As String

sHdColTwo = Range("Sheet1!B1").Value
sHdColThree = Range("Sheet1!C1").Value
sHdColFour = Range("Sheet1!D1").Value

Range("Sheet1!B3").Formula = "=" & sHdColTwo & "!B3"
Range("Sheet1!C3").Formula = "=" & sHdColThree & "!B3"
Range("Sheet1!D3").Formula = "=" & sHdColFour & "!B3"


End Sub

"Mike E" wrote in message
...
To clarify, I am referring to the use of cell contents as the worksheet
name, not the exact name itself. So in call A1 I have the contents
"January". I need to know how to use A1 (the contents therein) as the
name of the worksheet.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 10:35 AM.

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