LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Locking cells with a checkbox using a macro.

Hello. I have an ongoing problem. I am trying to lock cells so they
cannot be changed as long as a checkbox on the active sheet is checked.
I have some code, but it runs an error and doesn't quite work anyway.
I have another macro that fills the boxes with values, but I want the
users to be able to adjust those values. Only after the checkbox is
checked, I want the access to those cells to be locked. Here is a
sampling of the code I have so far:

Sub chkLockAttribs_Click()
'
'Private Sub chkLockAttribs_Click()


Dim myRng As Range
Dim myPwd As String


myPwd = "secret"


Set myRng = ActiveSheet.Range("C18, D19:D23, D25, D26:F26, J19:J23,
P33, P35")


ActiveSheet.Unprotect Password:=myPwd
myRng.Locked =
ActiveSheet.OLEObjects("chkLockAttribs").Object.Va lue
ActiveSheet.cmdRoll.Visible = Not
(ActiveSheet.chkLockAttribs.Value)
ActiveSheet.Protect Password:=myPwd



End Sub

The checkbox is chkLockAttribs and the button linked to a macro
generating values is cmdRoll. C18, D19:D23, D25, D26:F26, J19:J23,
P33, P35 is the range of cells I want to lock after the checkbox is
checked. I don't really need a password protection on this. It's more
a convienence thing.

So any suggestions? Any and all help appreciated.

-SplatterKat-

aka -Robert Lizak-

 
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
Locking everything except cells B4:B8 H New Users to Excel 2 July 6th 09 05:57 PM
Locking cells P. Zicari Excel Worksheet Functions 1 October 24th 07 11:42 PM
Locking Cells phil Excel Discussion (Misc queries) 1 December 6th 06 04:37 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Locking cells Chip Pearson Excel Programming 0 August 17th 03 10:21 PM


All times are GMT +1. The time now is 10:45 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"