VBA for grouping and outlining


Posted by Robert B on September 16, 2001 8:26 PM

I have found that when protection is switched on, collapsing and expanding the cells is not possible. Thus I had thought that could a VBA be written that allows sheets that are already protected to be automatically unprotected and expanded n subsequently protected again whenever the "1", "2" etc buttons or the +/- buttons are pressed. Could someone advise as to whether this is possible and probably the VBA code to achieve this. Thanks.



Posted by Ferenc on September 17, 2001 3:11 AM

If the sheet is protected without a password, the VBA code can be found by using the macro recorder :-

ActiveSheet.Protect

ActiveSheet.Unprotect


If the sheet is protected with a password :-

ActiveSheet.Protect password:="ThePassword"

ActiveSheet.Unprotect password:="ThePassword"