Using contents of cell to refer to a worksheet

M

Mike

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.
 
M

Mike E

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.
 
T

Tumbleweed

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top