Change color of cells based on checkbox

Occasional Contributor

I need to get a VBA formula to either hide a cell or change the color to hide the cell values so they are not visible - this will be tied to a checkbox - If the checkbox is true then color for cell is black if checkbox is false then color is grey and have the fill to be grey as well to hide the cell as well.

1 Reply

@tmadaras 

Here is a small VBA example with a sample file.

------------------------

Option Explicit

Private Sub CheckBox1_Click()

If CheckBox1.Value = True Then Range("A3").Interior.ColorIndex = 1 'black Else Range("A3").Interior.ColorIndex = xlNone 'no color

End If

End Sub

----------------

Hope I was able to help you :).

 

NikolinoDE

I know I don't know anything (Socrates)

Was the answer useful? Mark them as helpful!

This will help all forum participants.