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.
 
You shouldn't have to close and reopen it. However, you will probably have to recalculate the sheet to run the CELL("filename"...) again.
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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?
You just need to save as since the formula is based on filename, then any calculation will update the value.
 
Upvote 0

Forum statistics

Threads
1,223,646
Messages
6,173,536
Members
452,520
Latest member
Pingaware

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