I'm using code to rename worksheets based on input values in a difference worksheet. I do a simple link in cell Z1 to the list on my INPUTS worksheet, and the following code is on each worksheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Set Target = Range("Z1")
If Target = "" Then Exit Sub
On Error GoTo Badname
ActiveSheet.Name = Left(Target, 31)
Exit Sub
Badname:
MsgBox "Please revise the project code on the INPUTS tab." & Chr(13) _
& "It appears to contain one or more " & Chr(13) _
& "illegal characters." & Chr(13)
Range("A1").Activate
End Sub
I have this on the code for each sheet that needs to be changed. It works, but only after you click back on the worksheet after changing the cell value on my INPUTS worksheet. Is it possible to do it the other way around? VBA on the INPUTS sheet that will change the other worksheet names automatically when you change the cell value? And the names will change pretty often, so is there a way to mark these certain sheets so the code knows to rename them?
I hope that makes sense.
Thanks!!
Bookmarks