Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Chaplain Doug,
Chaplain Doug wrote: Excel 2003. In my VBA code I need to be able to determine if a particular worksheet exists within a given workbook. For instance, how do I determine if WbMaster.Worksheets(SheetName) exists without getting an error if it does not? Thanks for the help. Error handling is the quickest way to do this, especially if you have lots of worksheets: Public Function gbWorksheetExists(rsWorksheetName As String, _ Optional rwbWorkbook As Workbook = Nothing) As Boolean On Error Resume Next If rwbWorkbook Is Nothing Then Set rwbWorkbook _ = ActiveWorkbook gbWorksheetExists = Len(rwbWorkbook.Worksheets( _ rsWorksheetName).Name) End Function -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Determining if a value already exists in column(s) | Excel Discussion (Misc queries) | |||
How to check if a worksheet exists in worksheet collection | Excel Programming | |||
Worksheet Exists... | Excel Programming | |||
How can I tell if a worksheet exists? | Excel Programming | |||
Determining if a worksheet exists within a workbook | Excel Programming |