Renaming sheet using a cell with a date formula

Soulence

New Member
Joined
Aug 23, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I have a work book that is used for inventory . The first Sheet is the usage page, on it it has dates that are monday thru friday that are auto generated with a formula (=IF(WEEKDAY(F5,2)=5,F5+3, F5+1)).
Im having to change the sheet names that follow to coincide with the dates shown (01, 02, 03...ect...) each sheet is a inventory page and has a formula for a date which corresponds to first sheet date. (='July 2023'!$F$5)) . Is there a way to name the sheet to coincide with the date that is populated from the formula shown? (Example: July 01)/
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Welcome to the Board!

Yes it is possible to do with VBA.
But I am little unclear on some of the details.

How many sheets are in the workbook total?
What is the exact range that you want to use for each of the sheet names?
 
Upvote 0
Welcome to the Board!

Yes it is possible to do with VBA.
But I am little unclear on some of the details.

How many sheets are in the workbook total?
What is the exact range that you want to use for each of the sheet names?
there are 32 sheets in the book, the first page is monthly usage form and is named the month of the year, the rest of the pages correspond to the dates of monday through friday. each sheet already generates a date ate the top of the page (A3) that is pulls from the first page (='July 2023'!$F$5). my question is how can i automatically name the page from the date generated in A3 in (MM-YYYY))
the first page generates the date of the week M-F with (=IF(WEEKDAY(F5,2)=5,F5+3, F5+1)) I have been manually renameing the sheets to correspond to the date of M_F for the enitre month.
 
Upvote 0
Try this:
VBA Code:
Sub RenameSheets()

    Dim i As Long

'   Loop through sheets 2 to 32
    For i = 2 To 32
        Sheets(i).Name = Format(Sheets(i).Range("A3"), "mm-yyyy")
    Next i
    
End Sub
 
Upvote 0
Solution
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,215,087
Messages
6,123,050
Members
449,092
Latest member
ikke

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