EXCEL or VBA: Hide row based on cell value?

wageslave101

Board Regular
Joined
Jul 18, 2007
Messages
154
If an IF statement returns a FALSE can the entire ROW be hidden?

Code:
=IF($C$49="book1.xls", C63, FALSE)

:eek:

WageSlave101
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Code to the sheet module
Code:
Private Sub Worksheet_Calculate()
With Range("c10")
     .EntireRow.Hidden = (.Value = False)
End With
End Sub
Edited: code
 
Upvote 0
That worked amazingly for such a small code bit :biggrin: thank you very much.

Is it possible to apply this to a range? For example if I want to run this for rows c10:c25?

WageSlave101
 
Upvote 0
try
Code:
Private Sub Worksheet_Calculate()
With Range("c10:c25")
     .EntireRow.Hidden = False
     On Error Resume Next
     .SpecialCells(xlFormulas,4).EntireRow.Hidden = True
End With
End Sub
 
Upvote 0
or perhaps:

Code:
Private Sub Worksheet_Calculate()
Dim i As Integer
For i = 10 To 25
    With Cells(i, 3)
        .EntireRow.Hidden = (.Value = False)
    End With
Next i
End Sub
Cheers
 
Upvote 0

Forum statistics

Threads
1,214,613
Messages
6,120,515
Members
448,968
Latest member
Ajax40

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