Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Looking for code or a statement that comfirms if a tab in excel exists,
similar to FileExists method. Any suggestions? Thanks Marc |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Marc
There are many ways but I like to use a function for it 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 You can call the function in Your macro like this If SheetExists("Sheet1") = False Then 'not exist Else 'exist End If -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "MFINE" wrote in message ... Looking for code or a statement that comfirms if a tab in excel exists, similar to FileExists method. Any suggestions? Thanks Marc |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Ron. Worked great!
Marc "Ron de Bruin" wrote: Hi Marc There are many ways but I like to use a function for it 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 You can call the function in Your macro like this If SheetExists("Sheet1") = False Then 'not exist Else 'exist End If -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "MFINE" wrote in message ... Looking for code or a statement that comfirms if a tab in excel exists, similar to FileExists method. Any suggestions? Thanks Marc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If Worksheet exists...Then run code | Excel Programming | |||
Code to see if Comment Exists | Excel Programming | |||
VBA code to check if a custom chart exists | Excel Programming | |||
Worksheets Exists Code... | Excel Programming | |||
Help with code that checks if a sheet exists | Excel Programming |