Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Edit Locked Cells with UserForm only

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locked worksheet & hyperlinks (w/ select locked cells unchecked) dgold82 Excel Discussion (Misc queries) 1 July 10th 09 09:42 PM
Locked Cell - can still edit philcud Excel Worksheet Functions 2 October 27th 06 04:28 PM
edit comments in locked cells bmnjna2019 Excel Worksheet Functions 0 June 20th 06 12:21 AM
Code to edit directly in cells from userform Tom Ogilvy Excel Programming 0 September 7th 03 10:27 PM
Code to edit directly in cells from userform Harald Staff[_4_] Excel Programming 0 September 7th 03 10:09 PM


All times are GMT +1. The time now is 06:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"