View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Macro doesn't work on UserInterfaceOnly-protected sheet

Kasama,
Did you read the 'remarks" section in the help.
Does this apply ?

NickHK

"Kasama" wrote in message
...
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 the sheet is unprotected but when it's protected, the
macro fails (Run-time error 1004) even though protection was set for User
Interface Only.

The 'Protect' macro uses this code:
Sheets("Name").Protect Password:="password", UserInterfaceOnly:=True,
Contents:=True, DrawingObjects:=True

The 'Move' macro which aligns the drawing object selects it and uses this
code:
Selection.Left = .Columns("V").Left

I know I could add code at the beginning and end of 'Move' to Unprotect

and
Protect the sheet, but I thought that with 'UserInterfaceOnly:=True', I
should not need to do this?
--
Kasama