=cell("filename") problems

spcalan

Well-known Member
Joined
Jun 4, 2008
Messages
1,247
I have 3 worksheet ( Sheet1, Sheet2, Sheet3 )

I have this formula to populate the worksheet's name into a cell.
= cell("filename")

it works, but if I switch worksheets, the previous value stays the same.it seems the =cell("filename") is not updating when I switch to the sheet.

or am I missing something?


Is there an easier way to define a worksheet's name ( either formula or custom function? )
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
This should update

<code>=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))</code>
 
Upvote 0
I figured I would go a different route:

Sub update_name()
For Each ws In Worksheets
Select Case ws.Name
Case "Data", "Template", "Data2"
Case Else
Range("N2") = ActiveSheet.Name
End Select

Next ws
End Sub

but this only updates "N2", in the activesheet only.
what am I missing?
 
Upvote 0
perfecto ( as always ).

will you send me your address?
I want to send you a gift for the countless help you have given me over the years.
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,755
Members
449,094
Latest member
dsharae57

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