P
Patrick C. Simonds
Any way to get this to work? I want the worksheets to rename based on the
values or cells F1 and G1 of each worksheet
Sub Rename_Worksheets()
'
' Macro1 Macro
' Macro recorded 12/19/2005 by Cathy Baker
'
'
'This code runs to rename the worksheets
Dim wks As String
Dim Sh As Worksheet
'Application.ScreenUpdating = False
wks = ActiveSheet.Name
Const sStr As String = "F1 " & "G1"
On Error GoTo ErrHandler
For Each Sh In ThisWorkbook.Worksheets
Sh.Name = Sh.Range(sStr).Value
Next Sh
Worksheets(wks).Activate
Exit Sub
ErrHandler:
'MsgBox "Cell" & sStr & "on sheet" & sh.Name & "is not valid sheet name"
Resume Next
'Application.ScreenUpdating = True
End Sub
values or cells F1 and G1 of each worksheet
Sub Rename_Worksheets()
'
' Macro1 Macro
' Macro recorded 12/19/2005 by Cathy Baker
'
'
'This code runs to rename the worksheets
Dim wks As String
Dim Sh As Worksheet
'Application.ScreenUpdating = False
wks = ActiveSheet.Name
Const sStr As String = "F1 " & "G1"
On Error GoTo ErrHandler
For Each Sh In ThisWorkbook.Worksheets
Sh.Name = Sh.Range(sStr).Value
Next Sh
Worksheets(wks).Activate
Exit Sub
ErrHandler:
'MsgBox "Cell" & sStr & "on sheet" & sh.Name & "is not valid sheet name"
Resume Next
'Application.ScreenUpdating = True
End Sub