View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Juan Pablo González Juan Pablo González is offline
external usenet poster
 
Posts: 226
Default add sheet if statement

Try something like

Dim Sht As Worksheet
On Error Resume Next
Set Sht = ActiveWorkbook.Worksheets("Time")
On Error Goto 0
If Sht Is Nothing Then
Sheets.Add.Name = "Time"
End If

--
Regards

Juan Pablo González

"scrabtree" wrote in message
...
I want to run a certain VBA code if a sheet in a workbook
is present and not if it isn't. If there is a sheet
named "Time" I want it to do nothing. If there is no
sheet named "Time" I want it to add a sheet and name
it "Time".