Macro to rename multiple worksheets with the workbook name

prasadyanz

New Member
Joined
Oct 21, 2013
Messages
17
For example , consider a sheet name ABC_1, workbook name is XYZ.
I want to rename the sheets to "XYZ ABC_1" . Is it possible? i need to do it to multiple files, please help. thanks in
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi Prasadyanz

This will work for you:

Code:
Sub RenameSheets()
Dim FileName, SheetName As String
FileName = ActiveWorkbook.Name
SheetName = ActiveSheet.Name
Sheets(1).Name = FileName & " " & SheetName
End Sub

though it will only change the name of the first sheet in the workbook.

Dan
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,779
Members
449,049
Latest member
greyangel23

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