Vijay,
Use a function like
Function SheetExists(SheetName As String, Optional WBook As Workbook) As
Boolean
On Error Resume Next
SheetExists = CBool(Len(IIf(WBook Is Nothing, _
ThisWorkbook, WBook).Sheets(SheetName).Name))
End Function
You can then call this as
If SheetExists("Sheet1") = True Then
or
If SheetExists("Sheet1", Workbooks("Book2.xls")) = True Then
If you omit the workbook reference, it tests for the sheet in the same
workbook that contains the code, as shown in the first example. To test for
a sheet in another workbook, include the workbook reference as shown in the
second example.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)
"Vijay Kotian" <(E-Mail Removed)> wrote in message
news:117C1ECE-0B70-4C23-B6F5-(E-Mail Removed)...
> While working on various sheets some times i get a error message if the
> sheet
> is not there i would like to check prior to activating it. Is there any
> command available to check the sheets e.g. book7 or book9 etc.