ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Running Macros in a protected workbook (https://www.excelbanter.com/excel-discussion-misc-queries/237348-running-macros-protected-workbook.html)

Christian

Running Macros in a protected workbook
 
Hi,

I have just started to use macros in Excel worksheets at a basic level, I am
recording the macro using "key strokes" rather than righting the code. (This
I have yet to master)

My problem is that I have a workbook containing several sheets which contain
columns of data that I want to lock. However when the sheets are locked and
the macro run it generates errors. I have read through articles on
unprotecting the sheet but when I try to write these codes into VBA the macro
still doesn't work.

Can anyone give me a simple idiots guide answer

Many thanks

Rob

Per Jessen

Running Macros in a protected workbook
 
Hi Rob

First unprotect the sheet, then your code to manipulate the sheet. Finally,
protect the sheet again.

Worksheets("YourSheet").UnProtect Password:="JustMe"

and

Worksheets("YourSheet").Protect Password:="JustMe"

Hopes this helps.
....
Per


"Christian" skrev i meddelelsen
...
Hi,

I have just started to use macros in Excel worksheets at a basic level, I
am
recording the macro using "key strokes" rather than righting the code.
(This
I have yet to master)

My problem is that I have a workbook containing several sheets which
contain
columns of data that I want to lock. However when the sheets are locked
and
the macro run it generates errors. I have read through articles on
unprotecting the sheet but when I try to write these codes into VBA the
macro
still doesn't work.

Can anyone give me a simple idiots guide answer

Many thanks

Rob




All times are GMT +1. The time now is 09:16 AM.

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