Rename active worksheet as workbook

nalini.p2007

New Member
Joined
Sep 29, 2011
Messages
12
Want to rename the name of the sheet automatically to the name of the excel file.

I have tried this below coding but sheet tab has been renamed with the name "PERSONAL.XLSB"
----------------------------------------------------------------
Dim myname
myname = ThisWorkbook.Name
ActiveSheet.Select
ActiveSheet.Name = myname
-------------------------------------------------------------------------------------------
Please help me in the earlier instance.
Thanks!!
Nalini P
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
If you prefer to not have the ".xls" in your worksheet name, the code is:

Code:
Sub rename_Sheet()
Dim x As String
x = Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1)
ActiveSheet.Name = x
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

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