Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
I have a lot of workbooks with same structure which I unprotect with a macro in personal.xls. However some have one worksheet less, called "FTE" How can I test in this macro if a worksheet exists and if so unprotect it and if not goto next line. Cheers, Harold |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
dim TestWks as worksheet
set testwks = nothing on error resume next set testwks = activeworkbook.worksheets("fte") on error goto 0 if testwks is nothing then 'it ain't there else 'unprotect it end if ====== It may be simpler to just ignore the error when you try to unprotect it: on error resume next activeworkbook.worksheets("Fte").unprotect password:="hi there" on error goto 0 mohavv wrote: Hi, I have a lot of workbooks with same structure which I unprotect with a macro in personal.xls. However some have one worksheet less, called "FTE" How can I test in this macro if a worksheet exists and if so unprotect it and if not goto next line. Cheers, Harold -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Check if file exists | Excel Discussion (Misc queries) | |||
How to check if a file exists in an ftp folder | Excel Discussion (Misc queries) | |||
check if the sheet/tag exists | Excel Worksheet Functions | |||
check if worksheet exists | Excel Worksheet Functions | |||
Check if a number exists in a range? | Excel Discussion (Misc queries) |