Code to get worksheet name into a cell

Hydestone

Board Regular
Joined
Mar 29, 2010
Messages
137
Is it possible to have the worksheet name autopopulate into a cell?

Example - I want the sheet name to appear in cell F1. Is that possible? Also, if I rename Sheet 1 to 12345, the info in cell F1 would change from Sheet 1 to 12345.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Put this formula in F1:

Code:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)
 
Upvote 0
For some reason, when I copy the worksheet which is using the reference above, the new worksheet displays #VALUE in the cell, instead of the sheet name. If I save the file, it still says #VALUE . If I save, close, and reopen - the formula then works and the cell shows the worksheet name. Any way to get the sheet name to show without closing and reopening the workbook?
 
Upvote 0
Are you copying the sheet to a brand new workbook?
 
Upvote 0
Fluff hit the nail on the head, of course. The CELL("filename", A1) finds the full path...but if you haven't saved the workbook, there is no path. If you save it, does the sheet name update correctly?
 
Upvote 0
Yes, copying to new workbook. When I click save, nothing changes. When I close the book and then reopen, the information populates in the cell.

Any way to make it populate without closing and reopening?
 
Upvote 0
After saving press F9, does that make a difference?
 
Upvote 0

Forum statistics

Threads
1,223,640
Messages
6,173,502
Members
452,517
Latest member
SoerenB

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