Rename multiple Worksheets by a cell value (Date)

benlong

New Member
Joined
May 24, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi all,
I tried to google a day to solve this issue but it did not work. Can anyone help me to give me a solution, please?
How can I rename multiple worksheets (from sheet2) from a column value (Date) as the photo attached by using VBA code?
Thank you.

1621857941047.png
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Welcome to the Board!

Are there already enough tabs (worksheets) in the workbook to accomodate all the dates?
Are we always going to start with the second sheet, and will the existing sheets always be named 1,2,3,...?
 
Upvote 0
Welcome to the Board!

Are there already enough tabs (worksheets) in the workbook to accomodate all the dates?
Are we always going to start with the second sheet, and will the existing sheets always be named 1,2,3,...?
Hi Joe
yes, all dates have enough tabs to match them.
The original name of the tabs which are sheet1, sheet2, sheet3,...
 
Upvote 0
Try this:
VBA Code:
Sub MyRenameSheets()

    Dim s As Long
    Dim lr As Long
    Dim r As Long

'   Find the last row in column A with data
    lr = Sheets("Fill-In").Cells(Rows.Count, "A").End(xlUp).Row
    
'   Initialize first sheet to rename
    s = 2
    
'   Loop through all rows with data on Fill-In sheeting start in A20
    For r = 20 To lr
        Sheets(s).Name = Format(Sheets("Fill-In").Cells(r, "A"), "dd-mm-yy")
        s = s + 1
    Next r
    
End Sub
 
Upvote 0
Solution
You are welcome.
Glad I was able to help!
:)
 
Upvote 0

Forum statistics

Threads
1,213,564
Messages
6,114,334
Members
448,567
Latest member
Kuldeep90

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