View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 292
Default VBA test for the existance of a worksheet.

Hi Tom

Function SheetXists(sName As String) As Boolean
On Error Resume Next
SheetXists = Sheets(sName).Index
On Error GoTo 0
End Function

Sub test()
MsgBox SheetXists("Sheet1")
MsgBox SheetXists("YetAnotherSummary")
End Sub

HTH. Best wishes Harald

"Tom Peacock" <tpeacockathoustondotrrdotcom skrev i melding
...
I am looking for a true or false test in Excel 2000 VBA to indicate
wheather a sheet name exists in a workbook. Any ideas?

--
Tom