i am using this code to rename worksheets based on a value in a cell on that sheet
Dim sname As String
Dim i As Integer
For i = 1 To 40
Sheets(i).Select
sname = Range("a1").Value
Sheets(i).Name = Format(sname, "mm-dd-yy")
Next i
End Sub
a problem arises because in the process of renaming the new sheet number 1-3 are the old sheets 38-40. (it will not work to leave 10 - 12 unchanged because data is being moved.)
any suggestions on an easy way to take care of this -- i was thinking of renaming the sheets to something generic and then renaming to the new names.
thanks
john
Dim sname As String
Dim i As Integer
For i = 1 To 40
Sheets(i).Select
sname = Range("a1").Value
Sheets(i).Name = Format(sname, "mm-dd-yy")
Next i
End Sub
a problem arises because in the process of renaming the new sheet number 1-3 are the old sheets 38-40. (it will not work to leave 10 - 12 unchanged because data is being moved.)
any suggestions on an easy way to take care of this -- i was thinking of renaming the sheets to something generic and then renaming to the new names.
thanks
john