View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Fred[_17_] Fred[_17_] is offline
external usenet poster
 
Posts: 20
Default check and/or create sheet "xxx"

Hi !

The foloowing code tries to activate sheet "xxx". If it does not axist an
error is returned (Err.Number < 0) and a new sheet is added after the last
sheet and renamed to "xxx"

Sub CheckSheet()


On Error Resume Next
Sheets("xxx").Activate
If Err.Number < 0 Then
Worksheets.Add after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = "xxx"
End If

End Sub

Good Luck


"Tom" wrote in message
...
Hi,

I want to check if there is a sheet named "xxx".
If there is not I want to create sheet "xxx", if there
is : nothing has to be done

How can I do this in a Marco ?

Thx
Tom