Problem is, I have VBA code that changes the values of "protected"
cells, and it generates "Runtime error '1004' application-defined or
object-defined error" when I set protection on.
Ummm.. is there any way to protect a worksheet from user input, but
allow the VBA code to work?
but you must run it every time you open your workbook
A good place to run it is in the Workbook open event in the
Thisworkbook module
Private Sub Workbook_Open()
Dim Sh As Worksheet
For Each Sh In ThisWorkbook.Worksheets
Sh.Protect userinterfaceonly:=True
Next
End Sub
--
Regards Ron de Bruin
(Win XP SP-1 XL2002 SP-2)
www.rondebruin.nl
"Dave Cullen" <no_...@mail.com> schreef in bericht
news:3E3FE4D9...@mail.com...
Sure:
Sub test()
Sheets(1).Protect UserInterfaceOnly:=True
MsgBox "Locked"
Sheets(1).Cells(4, 4).Value = "See ? Locked cell entry !"
End Sub
HTH. Best wishes Harald
"Dave Cullen" <no_...@mail.com> wrote in message
news:3E3FE4D9...@mail.com...