View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
kkknie[_37_] kkknie[_37_] is offline
external usenet poster
 
Posts: 1
Default Error trap the renaming of a sheet to an existing one

How about trapping before the error occurs:

Dim s
Dim bFound as Boolean

bFound = False
For Each s in Sheets
If s.Name = sname Then bFound = True
Next

If bFound = True Then
Msgbox "Sheet name already entered", vbInformation
Exit Sub
End If

Sheets.Add.Name = sname



--
Message posted from http://www.ExcelForum.com