G
Guest
I am attempting to set a cell in a spreadsheet equal to a title of another
worksheet. Is this possible to do?
worksheet. Is this possible to do?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
JLatham said:Yes and no? This is almost one of those "you have to know the answer before
we will tell you the answer" type of things.
A formula that will give you the sheet name of a sheet in the workbook is
this one (entered into a cell on 'Sheet1' and pointed to a cell in another
sheet in the workbook [Sheet3])
=MID(CELL("address",Sheet3!A1),FIND("]",CELL("address",Sheet3!A1))+1,FIND("!",CELL("address",Sheet3!A1))-FIND("]",CELL("address",Sheet3!A1))-1)
If you'll put this formula into another cell on Sheet1 you will see the need
for the FIND() functions in it:
=CELL("address",Sheet3!A1)
So you have to know the name of the other sheet before you can ask for the
name of that other sheet. But if the name of the other sheet is changed
later, the formula will show the new name.
Another way to do this is using VB code to work through the list of sheets
in the workbook and put their names into cells in a particular workbook:
Sub ListSheetNames()
Dim anySheet As Worksheet
Worksheets("Sheet1").Select
Range("A1").Select
For Each anySheet In Worksheets
ActiveCell = anySheet.Name
ActiveCell.Offset(1, 0).Activate
Next
End Sub
amp4cats said:I am attempting to set a cell in a spreadsheet equal to a title of another
worksheet. Is this possible to do?
JLatham said:Yes and no? This is almost one of those "you have to know the answer before
we will tell you the answer" type of things.
A formula that will give you the sheet name of a sheet in the workbook is
this one (entered into a cell on 'Sheet1' and pointed to a cell in another
sheet in the workbook [Sheet3])
=MID(CELL("address",Sheet3!A1),FIND("]",CELL("address",Sheet3!A1))+1,FIND("!",CELL("address",Sheet3!A1))-FIND("]",CELL("address",Sheet3!A1))-1)
If you'll put this formula into another cell on Sheet1 you will see the need
for the FIND() functions in it:
=CELL("address",Sheet3!A1)
So you have to know the name of the other sheet before you can ask for the
name of that other sheet. But if the name of the other sheet is changed
later, the formula will show the new name.
Another way to do this is using VB code to work through the list of sheets
in the workbook and put their names into cells in a particular workbook:
Sub ListSheetNames()
Dim anySheet As Worksheet
Worksheets("Sheet1").Select
Range("A1").Select
For Each anySheet In Worksheets
ActiveCell = anySheet.Name
ActiveCell.Offset(1, 0).Activate
Next
End Sub
amp4cats said:I am attempting to set a cell in a spreadsheet equal to a title of another
worksheet. Is this possible to do?
amp4cats said:When attempting your solution, I received a #VALUE! error
JLatham said:Yes and no? This is almost one of those "you have to know the answer before
we will tell you the answer" type of things.
A formula that will give you the sheet name of a sheet in the workbook is
this one (entered into a cell on 'Sheet1' and pointed to a cell in another
sheet in the workbook [Sheet3])
=MID(CELL("address",Sheet3!A1),FIND("]",CELL("address",Sheet3!A1))+1,FIND("!",CELL("address",Sheet3!A1))-FIND("]",CELL("address",Sheet3!A1))-1)
If you'll put this formula into another cell on Sheet1 you will see the need
for the FIND() functions in it:
=CELL("address",Sheet3!A1)
So you have to know the name of the other sheet before you can ask for the
name of that other sheet. But if the name of the other sheet is changed
later, the formula will show the new name.
Another way to do this is using VB code to work through the list of sheets
in the workbook and put their names into cells in a particular workbook:
Sub ListSheetNames()
Dim anySheet As Worksheet
Worksheets("Sheet1").Select
Range("A1").Select
For Each anySheet In Worksheets
ActiveCell = anySheet.Name
ActiveCell.Offset(1, 0).Activate
Next
End Sub
amp4cats said:I am attempting to set a cell in a spreadsheet equal to a title of another
worksheet. Is this possible to do?
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.