Does a worksheet exist?
Here is a function...
Public Function SheetExists(SName As String, _
Optional ByVal WB As Workbook) As Boolean
'Chip Pearson
On Error Resume Next
If WB Is Nothing Then Set WB = ThisWorkbook
SheetExists = CBool(Len(WB.Sheets(SName).Name))
End Function
--
HTH...
Jim Thomlinson
"papa jonah" wrote:
I am trying to figure out what sort of code I can use in my vba that
would allow it to recognize whether a worksheet with a particular name
exists or not. I would like to use it in conjunction with an if-then
so that it will do one thing or another dependent on the presence (or
lack of) this sheet.
TIA
|