Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
Using Excel2003/2007 with Win XP/Vista. I have a userform which has a number of checkboxes to tick to show up the appropriate worksheets. ie to lessen clutter per individual user preference. Within my commandOK_click button i have the following code: If chkSh01 then Sh01.visible = xlSheetVisible else Sh01.visible=xlSheetVeryHidden If chkSh02 then Sh02.visible = xlSheetVisible else Sh02.visible=xlSheetVeryHidden .... If chkSh30 then Sh30.visible = xlSheetVisible else Sh30.visible=xlSheetVeryHidden etc to 30 sheets. Sh01, Sh02 ... thru to Sh30 refers to sheet property codename. Primarily to allow user change the name via the sheet tab AND also to allow delete of sheets but not add. If all the 30 sheets are there then the code works okay. But if one or more sheets are not there then the code fails with a compile error: "Variable not found". Qn: 1. how do i code so that if the sheet does not exist then that the error is ignored. What error catching routine can i use. Qn: 2. to avoid the "variable not found" i need to reference the Sh01 properly so that VBA knows its refering to a sheet object. I have to use the sheet codename as this is predetermined at design stage with the names Sh01 to Sh30 thus allowing the user to change tab name, delete the sheets but not add. Still learning and enjoying...Many thanks Rgds Kieranz |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Catching edit mode error | Excel Programming | |||
Catching an error | Excel Programming | |||
Worksheet Codename - Crazy Method Error! | Excel Programming | |||
globally catching any error event? | Excel Programming | |||
Catching an error | Excel Programming |