add sheet if statement
'-----------------------------------------------------------------
Function SheetExists(Sh As String, _
Optional wb As Workbook) As Boolean
'-----------------------------------------------------------------
Dim oWs As Worksheet
If wb Is Nothing Then Set wb = ActiveWorkbook
On Error Resume Next
SheetExists = CBool(Not wb.Worksheets(Sh) Is Nothing)
On Error GoTo 0
End Function
--
HTH
RP
"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".
|