Buttons


Posted by markt on January 11, 2002 11:05 AM

I have a worksheet with simple macro buttons to expand and contract a given row. With the worksheet protected and the button and entire row unlocked, the macro won't run. Any solutions out there?

Posted by Juan Pablo G. on January 11, 2002 11:07 AM

Unprotect the sheet at the beginning and protect it back at the end.

Juan Pablo G.

Posted by markt on January 11, 2002 11:11 AM

Been there, done that. I have, of course, created the macros and un-locked the cells and buttons with the page un-protected, then protected the sheet. Any other ideas? :)

Posted by Juan Pablo G. on January 11, 2002 11:12 AM

I meant at the beggining and end of the macro. That works.

Juan Pablo G.

Posted by markt on January 11, 2002 11:16 AM

I did understand that, and that is what I have done. You can't even write a macro if the page is protected. With the worksheet unprotected, I write the macro. Once complete, I protect the sheet. When I click the button to expand, with the sheet protected, I get a runtime error 1004: "Unable to set RowHeight property of the range class". There must be something else I'm leaving out or doing wrong!

Posted by Juan Pablo G. on January 11, 2002 11:19 AM

Then you're not understanding.

Try this WITH your sheet protected (Change "MYPASSWORD" to your real password)

Sub Testing
ActiveSheet.Unprotect "MYPASSWORD"
Rows(20).RowHeight = 25
ActiveSheet.Protect "MYPASSWORD"
End Sub

Juan Pablo G.



Posted by markt on January 11, 2002 11:31 AM

Got it!!! Thanks, Juan Pablo G. I'm a bit of a novice at VB, but thanks to your help, I got it done! THANKS. MT.