Hiding a Row based on Cell Value

Boykickscar

New Member
Joined
Mar 13, 2017
Messages
7
Hi there,

I have a series of checkboxes linked to cells in a row (A2, B2, C2 etc. up to U2) and if a check box is ticked then the corresponding cell = "True", if the box is not ticked then = "False"

What I'd like to do not is use the call values of "True" or "False" to Hide/Unhide Rows (starting at Row 7 then going down to Row 28).

so True = Unhide, False = Hide.

I have no clue how to do this and would be grateful of any help.

Thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try

Code:
Sub hidetruefalse()
For i = 1 To 21
If Cells(2, i) = True Then
    Columns(i).EntireColumn.Hidden = False
    Else
    Columns(i).EntireColumn.Hidden = True
End If
Next i
End Sub
 
Upvote 0
You should not have to change anything. What happens when you run the code?
 
Upvote 0
It runs with any debug errors, but then nothing happens within the worksheet itself :S

Apologies if I'm missing something obvious.
 
Upvote 0
Are you running the code with the sheet with the TRUE/FALSE in row 2 as the active sheet?
 
Upvote 0
here's what I've done to amend the code for Rows;

Code:
Sub hidetruefalse()
For i = 9 To 29
If Cells(2, i) = True Then
    Rows(i).EntireRow.Hidden = False
    Else
    Rows(i).EntireRow.Hidden = True
End If
Next i
End Sub

however it doesn't matter what checkboxes are ticked or unticked rows 23-29 are always hiding.

any thoughts?


Thanks
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top