can I dsplay the sheet name in a cell

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
This is an odd question. Within excel I do not know of a way that you can print the worksheet name in a cell. However, I just wrote this function to see if it would work and it pretty much did so you can try it.

Function WorksheetName() As String
ActiveSheet.Activate
WorksheetName = ActiveSheet.Name
End Function

Paste this in the visual basic editor and then you can write, in a cell, "=worksheetname()" and the name of the worksheet will appear in the cell. One caveat, though, the code gives instructions to print the active sheets' name in the cell, therefore, if you can find a way to view a sheet that's not the active sheet, the cell will print the wrong name. I don't know if you can even do that. Anyway, I hope this helps you a little bit.

Dave
 
Upvote 0
On 2002-03-05 13:53, Anonymous wrote:
Is there a way to display a sheet name in a
cell

In B1 enter:

=CELL("filename",A1)

In C1 enter:

=RIGHT(B1,LEN(B1)-SEARCH("]",B1))

Note. B1 and C1 can be any other unused cells.
 
Upvote 0
Or in one cell:

=RIGHT(CELL("filename"),LEN(CELL("filename"))-SEARCH("]",CELL("filename")))

Cell("filename"), I just learned, returns the path to your file including the current sheet that is active, with the workbook in brakets (so the end of the path looks like this: [book1]Sheet1). The right function cuts out the rest of the path and leaves you with just the sheet. However, if the workbook you are working with HAS NOT BEEN SAVED, the cell("filename") function will return a blank string (""). If you were having trouble with this, make sure you save the workbook.

Dave
 
Upvote 0
On 2002-03-05 14:52, davers5 wrote:
Or in one cell:

=RIGHT(CELL("filename"),LEN(CELL("filename"))-SEARCH("]",CELL("filename")))

Cell("filename"), I just learned, returns the path to your file including the current sheet that is active, with the workbook in brakets (so the end of the path looks like this: [book1]Sheet1). The right function cuts out the rest of the path and leaves you with just the sheet. However, if the workbook you are working with HAS NOT BEEN SAVED, the cell("filename") function will return a blank string (""). If you were having trouble with this, make sure you save the workbook.

Dave

The reason I suggest using 2 cells is to avoid computing the same thing many times.

And,

=CELL("filename",A1)

is better than just

=CELL("filename")

Aladin
 
Upvote 0
When using the cell("filename") function, it's safer to include ,a1 option because it assures that formula references the file and sheet the formula is on and not the file and sheet that you last did a recalc on.
 
Upvote 0

Forum statistics

Threads
1,213,528
Messages
6,114,154
Members
448,553
Latest member
slaytonpa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top