ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? (https://www.excelbanter.com/excel-programming/366917-if-i-have-work-sheet-protected-try-run-macro-hide-rows-columns-wont-work-correct.html)

Marc

If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct?
 
Marc



Norman Jones

If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct?
 
Hi Marc,

Try:

Activesheet.Unprotect

'Your code

Activesheet.Protect


---
Regards,
Norman



"Marc" wrote in message
nk.net...
Marc





Mark Ivey

If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct?
 
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

--
Mark Ivey
"Marc" wrote in message nk.net...
Marc




All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com