check to see if sheet exists

  • Thread starter Thread starter Wandering Mage
  • Start date Start date
W

Wandering Mage

Is there anyway to see if a sheet of a given name exists.
I want to write and if statement:
if Sheet("rev date") *does exist* Then
true condition
Else
false condition
End If

I there a way to do this?
 
Here's a function

'-----------------------------------------------------------------
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top