A
Amanda
I am having a serious problem setting the forecolor and
back color to my checkboxes in excel.
I want the backcolor and forecolor to change depending on
the color of the cell to the left of it. The checkboxes
are linked to the cells, and the color should match the
background cell to be uniform.
Here is my code:
Can anyone please tell me what I doing wrong? I have spent
HOURS trying to figure this out
Sub Macro5()
Dim Colornum As Long
'Dim CheckboxNum As Integer
CheckboxNum = 1
If CheckboxNum < 143 Then
For i = 12 To 187
Colornum = Application.Worksheets
("BMX_ws").Range("f" & i).Interior.ColorIndex
If (i < 106 Or i > 123) And (i < 156 Or i > 171)
Then
ActiveSheet.Shapes("Checkbox" &
CheckboxNum).Select
With Selection.ShapeRange
If Colornum = 36 Then
.Fill.ForeColor.RGB = 8454143
.Fill.BackColor.RGB = 8454143
CheckboxNum = CheckboxNum + 1
Else
.Fill.ForeColor.RGB = 12632256
.Fill.BackColor.RGB = 12632256
CheckboxNum = CheckboxNum + 1
End If
End With
End If
Next i
End If
End Sub
back color to my checkboxes in excel.
I want the backcolor and forecolor to change depending on
the color of the cell to the left of it. The checkboxes
are linked to the cells, and the color should match the
background cell to be uniform.
Here is my code:
Can anyone please tell me what I doing wrong? I have spent
HOURS trying to figure this out
Sub Macro5()
Dim Colornum As Long
'Dim CheckboxNum As Integer
CheckboxNum = 1
If CheckboxNum < 143 Then
For i = 12 To 187
Colornum = Application.Worksheets
("BMX_ws").Range("f" & i).Interior.ColorIndex
If (i < 106 Or i > 123) And (i < 156 Or i > 171)
Then
ActiveSheet.Shapes("Checkbox" &
CheckboxNum).Select
With Selection.ShapeRange
If Colornum = 36 Then
.Fill.ForeColor.RGB = 8454143
.Fill.BackColor.RGB = 8454143
CheckboxNum = CheckboxNum + 1
Else
.Fill.ForeColor.RGB = 12632256
.Fill.BackColor.RGB = 12632256
CheckboxNum = CheckboxNum + 1
End If
End With
End If
Next i
End If
End Sub