Thread: Excel VBA
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud Bill Renaud is offline
external usenet poster
 
Posts: 417
Default Excel VBA

Patrick wrote:
<<I'm interested in how I check the name of the new worksheet, i.e. to
avoid that the same name exists already.

Public Function SheetExists(SheetName As String) As Boolean
Dim sht As Object

On Error Resume Next

Set sht = Sheets(SheetName)

SheetExists = Not (sht Is Nothing)
End Function

There are routines that are even more general purpose for determinining
if an object is in a collection or not, but the one above should work
for your purposes.
--
Regards,
Bill Renaud