View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Libby Libby is offline
external usenet poster
 
Posts: 151
Default Edit Locked Cells with UserForm only

Hi Benjamin,

You can either specify that you want to allow programmatic changes when you
open the workbook.
Private Sub Workbook_Open()
Sheet1.Protect userinterfaceonly:=True
End Sub

or you can uprotect and reprotect your worksheet when you make the change

Private Sub Commandbutton1_Click()
sheet1.unprotect
'make changes
sheet1.protect
end sub



"Benjamin" wrote:

I have three cells in worksheet that I want to remain locked on the worksheet.
And I only want the userform to allow these cells to be updates.
The ok button on the form updates these cells. But now it gives me this
error since the workbook is now locked:
Run-time error '1004'
I need to unlock it and lock it again.
need VBA code help here.