Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
check for worksheets
How do I check to see if a worksheet already exists before creating it using
VBA? |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
check for worksheets
I stole this from Chip Pearson:
Function WorksheetExists(SheetName As Variant, _ Optional WhichBook As Workbook) As Boolean 'from Chip Pearson Dim WB As Workbook Set WB = IIf(WhichBook Is Nothing, ThisWorkbook, WhichBook) On Error Resume Next WorksheetExists = CBool(Len(WB.Worksheets(SheetName).Name) 0) End Function 'and you can use it like: .... if worksheetexists("myname",activeworkbook) then erlanr wrote: How do I check to see if a worksheet already exists before creating it using VBA? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Spell Check in Protected Worksheets | Excel Discussion (Misc queries) | |||
check register with multiple worksheets | Excel Discussion (Misc queries) | |||
How do I check for duplicates across multiple worksheets | Excel Worksheet Functions | |||
Allowing spell check on protected worksheets | Setting up and Configuration of Excel | |||
need check two worksheets to lookup a value | Excel Discussion (Misc queries) |