Rename worksheet as active workbook name

nalini.p2007

New Member
Joined
Sep 29, 2011
Messages
12
Hi,

wanted to rename the worksheet as per the file name of the excel.

Please suggest me any vba coding in the earlier instance.

Thanks in advance!!
Nalini P
 
Last edited:

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Not sure if you mean this....
Code:
[/FONT]
[FONT=Courier New]Sub TEST()
On Error GoTo errorhndler
ActiveSheet.Name = ThisWorkbook.Name
Exit Sub
errorhndler:
MsgBox Err.Description
End Sub
 
Upvote 0
Thanks for your help Pedie. i have tried this code and it is not working. sheet has been renamed as "PERSONAL.XLSB" after implementing the code .. Please advice me on this.
 
Upvote 0
I am getting same error for below coding also.

Dim myname
myname = ThisWorkbook.Name
ActiveSheet.Select
ActiveSheet.Name = myname
End sub
Please help me
 
Upvote 0
Thanks for your help Pedie. i have tried this code and it is not working. sheet has been renamed as "PERSONAL.XLSB" after implementing the code .. Please advice me on this.

Nalini, i thought you said you want to rename the sheet as per the workbook name...:)
This code will rename the active sheet as the current workbook name;

i'm not sure now what you're wanting to do

Do you have the workbook names in list/somewhere in the sheet that you want to create and rename it accordingly?
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,818
Members
452,946
Latest member
JoseDavid

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