Hello All,
I am using a code that the awesome @HighAndWilder helped me with but I needed a little more assistance.
To set the premise, I wanted to have E4:F11 hidden when the checkbox is unchecked and when it is checked to have the cells visible and formatted (which that does work but need a little more).
The first thing is this code creates a border around the range, which I do want but I was wondering if there was a way to do horizontal and/or vertical borders on a certain range. For example on the screen shot below, I would want thin borders on the bottom of E5:F5, bottom of E7:F7 and the bottom of E9:F9 and still keep the thick borders on the whole range (E4:F11).
Second thing; with the code below, I was wondering if there was a way to only change the colors of some of the cells. For instance on this screenshot I would want E5,E7, E9, and E11 white filled(the rest the red color).
I am using ActiveX Checkboxes and ActiveX buttons on other parts of the sheet. this is for work so i cant upload the sheet but I can answer more questions and upload more screenshots if needed. I am still very new to using VBA and ActiveX controls so I would appreciate the help!
I am using a code that the awesome @HighAndWilder helped me with but I needed a little more assistance.
To set the premise, I wanted to have E4:F11 hidden when the checkbox is unchecked and when it is checked to have the cells visible and formatted (which that does work but need a little more).
The first thing is this code creates a border around the range, which I do want but I was wondering if there was a way to do horizontal and/or vertical borders on a certain range. For example on the screen shot below, I would want thin borders on the bottom of E5:F5, bottom of E7:F7 and the bottom of E9:F9 and still keep the thick borders on the whole range (E4:F11).
Second thing; with the code below, I was wondering if there was a way to only change the colors of some of the cells. For instance on this screenshot I would want E5,E7, E9, and E11 white filled(the rest the red color).
I am using ActiveX Checkboxes and ActiveX buttons on other parts of the sheet. this is for work so i cant upload the sheet but I can answer more questions and upload more screenshots if needed. I am still very new to using VBA and ActiveX controls so I would appreciate the help!
Excel Formula:
[/HEADING]
Private Sub CheckBox5_Click()
With ActiveSheet
If .Range("E4").Interior.Color = vbWhite Then
With .Range("E4:E11", "F5:F11")
.Interior.Color = RGB(220, 86, 65)
.Font.Color = RGB(0, 0, 0)
End With
Range("E4:E11", "F5:F11").BorderAround _
LineStyle:=xlContinuous, _
Weight:=xlThick, _
Color:=RGB(0, 0, 0)
Else
With .Range("E4:E11", "F5:F11")
.Font.Color = RGB(255, 255, 255)
.Interior.ColorIndex = xlNone
With .Borders
.LineStyle = xlNone
End With
End With
End If
End With
End Sub
[HEADING=3]
Excel Formula:
[/HEADING]
Private Sub CheckBox5_Click()
With ActiveSheet
If .Range("E4").Interior.Color = vbWhite Then
With .Range("E4:E11", "F5:F11")
.Interior.Color = RGB(220, 86, 65)
.Font.Color = RGB(0, 0, 0)
End With
Range("E4:E11", "F5:F11").BorderAround _
LineStyle:=xlContinuous, _
Weight:=xlThick, _
Color:=RGB(0, 0, 0)
Else
With .Range("E4:E11", "F5:F11")
.Font.Color = RGB(255, 255, 255)
.Interior.ColorIndex = xlNone
With .Borders
.LineStyle = xlNone
End With
End With
End If
End With
End Sub
[HEADING=3]