View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Check for a tab if it is exist

Something like this function should work...

Private Function SheetExists(sname) As Boolean
On Error Resume Next
IsError ActiveWorkbook.Sheets(sname)
SheetExists = Err.Number = 0
End Function

Just call it from your own code (macro, function, event procedure, etc.)
like this...

MsgBox SheetExists("AAA")

The function returns True if the sheet exists and False if it doesn't exist.

--
Rick (MVP - Excel)


"Farhad" wrote in message
...
Hi all,

i want to check in an Excel file for a tab name for example "AAA" and see
if
this tab name is exist in the file or not everyone please help me.

Thanks,
--
Farhad Hodjat