#1   Report Post  
Luke
 
Posts: n/a
Default 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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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
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
check a checkbox in a formula big t Excel Worksheet Functions 1 June 16th 05 06:32 PM
Help with function to add percentage to cell based on checkbox. foxgguy2005 Excel Worksheet Functions 3 June 1st 05 05:52 AM
copy many CHECKBOX Taha Elian Excel Discussion (Misc queries) 1 April 28th 05 06:06 PM
How do I make a checkbox bigger? DMD Excel Discussion (Misc queries) 2 April 7th 05 08:41 PM
Checkbox saturn586 Excel Worksheet Functions 1 March 14th 05 07:24 AM


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