Lisa has attended:
Excel Intermediate course
Excel Advanced course
Auto Hiding a row in Excel
Hi
I'm trying to use VBA to autohide rows when a cell value is returned as false.
THe cells that false is being returned in are R4:R1500.
Can you advise?
Thanks
RE: Auto Hiding a row in Excel
Hi Lisa
One way to hide rows containing FALSE is to use Data, Filter.
Here is an example with 3 column headings
P..........Q.......R
Grade Status Result
A........1........OK
B........1........OK
B........2........FALSE
A........1........OK
B........3........FALSE
Result is OK if Grade="A" or Status=1
Otherwise Result is FALSE
Formula:
=IF(OR(P4="A",Q4=1),"OK")
Here is a macro called HideFalse to carry out this Autofilter
Sub HideFalse()
Range("R3").Select
Selection.AutoFilter
ActiveSheet.Range("R3").CurrentRegion.AutoFilter Field:=3, Criteria1:="<>FALSE"
End Sub
In your case Field:=3 will be the position of your R column within your data. (eg if R is the 10th column then change to Field:=10)
Hope that help?
Regards
Doug Dunn
Best STL