Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
Dim EndNumber as String
On Error resume next
EndNumber = 0
sh.Name = sh.Range("a1").Value
Retest:
if err.number <> 0 then
EndNumber=EndNumber + 1
err.clear
sh.Name = sh.Range("a1").Value + "(" + EndNumber + ")"
goto Retest
end if
end sub
If there is already a sheet with the same name, this will add a 1, 2, etc at
the end. If you put it in the workbook module, it should run automatically.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.