In Excel, can you hide a range of cells with a checkbox?

New Contributor

I made a Excel worksheet for "Paint to additive" ratio for different materials, glass, metal, ect.
I want to use a checkbox to hide a range of cells with calculations/results for materials not used.
Range- E24 to J28 ??

3 Replies
You can have that happen but it requires a macro (VBA).
Let me suggest an alternative:
A checkbox will 'control' a cell and change the value of that cell accordingly. Then use Conditional Formatting using a user defined formula (=$M$1 if M1 is the cell the checkbox is linked to) to 'hide' the range (i.e. format those cells with the same text color and background)
I was leaning towards Macro. I have 3 different ranges of cells w/ some complex formulas. I know somewhat about hiding columns and rows not a range. ex. E24 to J28
yeah, there is no way to 'hide' a range that doesn't include full row or full columns (not even sure what that would look like except in the sense or them being a white block, which is what conditional formatting would produce).
So a macro could do the essentially same thing making those range(s) white out, but conditional formatting would be much easier. I'm not sure what your complex formulas have to do with it but if you don't want to use conditional formatting, and those ranges are formulas or constants, you could also simply add an if statement to check for the checkbox state and either display the value or ""