J
Jim G
I have the following code that changes the sheet name based on the entry in
cell A1. This allows the user to create multiple sheet copies of a template
then updateing the data in each without needing to update sheet names as they
go.
Sub UpdateTabName()
Dim Ws As Worksheet
‘ the macro will rename all sheets in the active workbook to the contents of
A1
With ActiveWorkbook
For Each Ws In Worksheets
Ws.Name = Ws.Range("A1") ‘ change to the cell address to be used
Next Ws
End With
End Sub
I would like to insert a error trap and message for when the target cell is
blank or has illegal characters. Ideally, I would like to provide a means
for the user to be prompted for a new name for that sheet. If that is not
possible or practical, insert a temporary name and alert the user to change
it.
Any suggestions?
cell A1. This allows the user to create multiple sheet copies of a template
then updateing the data in each without needing to update sheet names as they
go.
Sub UpdateTabName()
Dim Ws As Worksheet
‘ the macro will rename all sheets in the active workbook to the contents of
A1
With ActiveWorkbook
For Each Ws In Worksheets
Ws.Name = Ws.Range("A1") ‘ change to the cell address to be used
Next Ws
End With
End Sub
I would like to insert a error trap and message for when the target cell is
blank or has illegal characters. Ideally, I would like to provide a means
for the user to be prompted for a new name for that sheet. If that is not
possible or practical, insert a temporary name and alert the user to change
it.
Any suggestions?