|
-
Dec 8th, 2003, 01:11 PM
#1
Thread Starter
Member
Checkboxes in Excel?
I posted this earlier then changed my profile and poof, everything was gone. Anyway, here we go again. I am working in Excel on some quality documents that I would like to have a little more automated using VBA. I have three colors and two checkboxes. If I put one color in a designated cell then I want one of the checkboxes to become checked. If I put in another color, I would like the other checkbox checked. Any chance that this can be done? Can one checkbox trigger another checkbox on another sheet within the workbook to be checked?
-
Dec 9th, 2003, 04:23 AM
#2
For the first part, you could do something like this:
VB Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim intSelSheet As Integer
' Check the cell to see if it's fill colour's changed to red,
' If so, set the 1st checkbox to on.
If Range("F3").Interior.ColorIndex = 3 Then
chkCellColour1.Value = True
chkCellColour2.Value = False
' Otherwise, check if it's blue & set the other checkbox
' (turning the first checkbox value to off).
ElseIf Range("F3").Interior.ColorIndex = 5 Then
chkCellColour1.Value = False
chkCellColour2.Value = True
' Finally, if the cell has bot been filled with blue
' or red, turn both checkboxes to off.
Else
chkCellColour1.Value = False
chkCellColour2.Value = False
End If
End Sub
Just change the "Interior.ColorIndex" bit to read "Font.ColorIndex" depending on whether you're checking the fill or the font colour of the cell...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|