Renaming Multiple Worksheets

uberathlete

Board Regular
Joined
Jul 11, 2007
Messages
117
Hi everyone. Got a problem and I really need some help. Basically, I have a workbook with plenty of worksheets. I would like to rename the worksheets based on some criteria.

For example, in each worksheet, column A is a column for dates. None of the worksheets have the same dates:

626juw6.jpg


I would like the worksheet to be named: SXFMONTHDAY.YEAR

wherein MONTH is the first 3 letters of the month , DAY is the day , and year is the last 2 digits of the year. So in this case, Sheet1 would be named: SXFJan3.06

Then, Sheet2 will be renamed based on it's date and the worksheet name format just mentioned. The rest of the worksheets are also renamed the same way.

I'm sure some VBA is needed for this but I'm really bad at it. Any suggestions or comments would be greatly appreciated. Thank you!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

PATSYS

Well-known Member
Joined
Mar 12, 2006
Messages
1,750
Hi everyone. Got a problem and I really need some help. Basically, I have a workbook with plenty of worksheets. I would like to rename the worksheets based on some criteria.

For example, in each worksheet, column A is a column for dates. None of the worksheets have the same dates:

626juw6.jpg


I would like the worksheet to be named: SXFMONTHDAY.YEAR

wherein MONTH is the first 3 letters of the month , DAY is the day , and year is the last 2 digits of the year. So in this case, Sheet1 would be named: SXFJan3.06

Then, Sheet2 will be renamed based on it's date and the worksheet name format just mentioned. The rest of the worksheets are also renamed the same way.

I'm sure some VBA is needed for this but I'm really bad at it. Any suggestions or comments would be greatly appreciated. Thank you!

Press ALT+F11, insert module, paste below code:


Code:
Sub test()

Dim Sht As Worksheet


For Each Sht In Worksheets
    With Sht
    .Name = "SFX" & Format(.Range("a2"), "mmmdd") & "." & Format(.Range("a2"), "yy")
    
    End With

Next Sht

End Sub

Press F5 to run the codes.
 

Forum statistics

Threads
1,181,730
Messages
5,931,703
Members
436,799
Latest member
BasOo

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
Top