Hi all,
What I am trying to do is rename two sheets. Both start off with specific names with identical dates in the sheet name as they need to be saved separately for upload.
So for sheet A, I'm wanting to locate the sheet that contains text "Totals - MM.DD.YYY" then rename by concatenating "Totals -" and a new date based on a cell in Sheet A.
For sheet B, I need to do basically the same thing except with different text, still using the date in Sheet A.
This is what I have so far.
I'm not really sure how to search for a sheet containing certain text, or concatenate when renaming the sheet. If you could help me out, I would really appreciate it. Thanks!
What I am trying to do is rename two sheets. Both start off with specific names with identical dates in the sheet name as they need to be saved separately for upload.
So for sheet A, I'm wanting to locate the sheet that contains text "Totals - MM.DD.YYY" then rename by concatenating "Totals -" and a new date based on a cell in Sheet A.
For sheet B, I need to do basically the same thing except with different text, still using the date in Sheet A.
This is what I have so far.
VBA Code:
Sub Rename()
' To set dynamic worksheet names
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name = "Totals - MM.DD.YYYY" Then
ws.Name = ws.Range("B11").Value
esle
ws.Name = ws.Range("B11").Value
End If
Next
Application.ScreenUpdating = True
End Sub
I'm not really sure how to search for a sheet containing certain text, or concatenate when renaming the sheet. If you could help me out, I would really appreciate it. Thanks!