View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Zilla[_2_] Zilla[_2_] is offline
external usenet poster
 
Posts: 51
Default Cell/worksheet protection with macros enabled

Also, how can I just process the "unlocked" cells? IOW,
if cell is locked, don't run your code!

-Zilla

"Zilla" wrote in message
...
Thanks. if the sheet is NOT password protected, will these be the
3 lines I would need to put in-line with existing code?

DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True


Is that last line also "=True._" or really "=True" as you've typed it.

-Zilla

"JLatham" <HelpFrom @ Jlathamsite.com.(removethis) wrote in message
...
You can unprotect the sheet incode, do your processing then put it back

into
protected mode. Code something like this:

Sub PasswordsInCode()
ActiveSheet.Unprotect Password:="sheetpasswordhere"
' your processing here
ActiveSheet.Protect Password:="sheetpasswordhere", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True
End Sub



"Zilla" wrote:

I'm using a VBA macro courtesy of Debra D. on this NG
to temproraily resize the column for a drop-down list. All
work fine.

Now I've lock some of these cells that this macro runs
on, and enabled sheet protection on "Contents" only.
Now when I use my spreadsheet, I get an Run-time
Error 1004 - Unable to set column width property of
the range class. I've tried protection with either "Objects"
or "Scenarios" only checked, to no avail.

I gues this means I can not run macros that muck with
cell "properties" with sheet protection?

--
- Zilla
(Remove XSPAM)