renaming the worksheets incrementally

kin1

New Member
Joined
Mar 31, 2011
Messages
37
hello,

can someone help me with a macro that includes a loop that will rename the worksheets within a work book as 01, 02, 03, etc. the number of worksheets are dynamic.

thanks,
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Code:
Dim i As Long
For i = 1 To Worksheets.Count
    Worksheets(i).Name = Format$(i, "##")
Next i
 
Upvote 0
Code:
Sub NameSheets()
Dim ws As Worksheet
Dim i As Integer
i = 1
For Each ws In Worksheets
ws.Name = i
i = i + 1
Next
End Sub
 
Upvote 0
try this

Code:
Sub Rename_Sheets()
    Dim i As Integer, x As Integer
       x = 1
    For i = 1 To ActiveWorkbook.Worksheets.Count
        Sheets(i).Activate
        Sheets(i).Name = WorksheetFunction.Text(x, "00")
        x = x + 1
    Next i
MsgBox "Done"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,634
Members
452,934
Latest member
Jdsonne31

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