keyongtech


  keyongtech > excel.* > excel.programming > 07/2006

 #1  
07-12-06, 03:48 AM
Marc
Marc
 #2  
07-12-06, 03:53 AM
Norman Jones
Hi Marc,

Try:

Activesheet.Unprotect

'Your code

Activesheet.Protect

 #3  
07-12-06, 04:10 AM
Mark Ivey
I believe you are correct, but there are other options.

Take for instance... you can have your macro unprotect your sheet - run your macro - and then reprotect your sheet.

Sub MyMacro()
Dim Password 'This line of code is optional
Password = "1234"
ActiveSheet.Unprotect Password

~~ Your macro code goes here ~~

ActiveSheet.Protect Password, True, True, True
End Sub
Similar Threads
Macro doesn't work when sheet protected

This is the Macro I have in my work sheet. Even when I set G3:F3 as un-locked the Macro ceases to reset the color in respect to the cell contents. When I un-protect the...

Macro doesn't work on UserInterfaceOnly-protected sheet

Shouldn’t ‘UserInterfaceOnly:=True’ allow macros to change the sheet? My worksheet has a Shape which moves to align with Column V when a macro is run. It works while...

Macro protected work sheet

Hi All, I've use macro to protect the sheet with the group function work, as follow: Sub Auto_Open() With Worksheets("Sheet1") .Protect Password:="hi",...

Why when I use hide columns / rows the undo does not work.

When I put commands in the spreadsheet with the right click and view code, then following this, the undo command no longer works. However, after I remove the code it...

Macro (assigned to button) doens't work when sheet is protected

I have a worksheet with some cumbersome formulae that I wish to hide/lock/protect. I am able to do this, however when I protect the sheet it seems to disable the macros...


All times are GMT. The time now is 04:39 PM. | Privacy Policy