View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Newbie Newbie is offline
external usenet poster
 
Posts: 40
Default Error trap the renaming of a sheet to an existing one

Thanks - trapping before the error I agree is a better way to go

Thanks again
A
"kkknie " wrote in message
...
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

K


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