Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Checkbox
Hi
When a checkbox is checked I need it to allow data to be entered in certain cells. If the checkbox is uncheck the cells would be greyed out and data could not be entered. Is this possible? Many thanks Luke |
#2
|
|||
|
|||
Excel doesn't quite work like that.
But you can use a combination of worksheet protection and the "locked-ness" of a cell to do what you want. I put a checkbox from the forms toolbar on a worksheet. I added this code to a general module: Option Explicit Sub testme() Dim myCBX As CheckBox Dim myRng As Range Dim myCell As Range Dim myPWD As String myPWD = "hi" With ActiveSheet Set myRng = .Range("a1,c3,e6,H12") Set myCBX = .CheckBoxes(Application.Caller) .Unprotect Password:=myPWD For Each myCell In myRng.Cells If myCBX.Value = xlOff Then myCell.Locked = False myCell.Interior.ColorIndex = xlNone Else myCell.Locked = True myCell.Interior.ColorIndex = 15 End If Next myCell .Protect Password:=myPWD End With End Sub I assigned this macro to the checkbox and it seemed to work ok for me. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Luke wrote: Hi When a checkbox is checked I need it to allow data to be entered in certain cells. If the checkbox is uncheck the cells would be greyed out and data could not be entered. Is this possible? Many thanks Luke -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
check a checkbox in a formula | Excel Worksheet Functions | |||
Help with function to add percentage to cell based on checkbox. | Excel Worksheet Functions | |||
copy many CHECKBOX | Excel Discussion (Misc queries) | |||
How do I make a checkbox bigger? | Excel Discussion (Misc queries) | |||
Checkbox | Excel Worksheet Functions |