View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default macro that displays function from 2 columns

Assuming you have boolean true and false inthe cells and not text true and
false then...

Public Sub HideFalse()
Dim rng As Range
Dim rngToSearch As Range

With Sheets("Sheet1") 'Specify the sheet
Set rngToSearch = .Range(.Range("A1"), .Cells(Rows.Count, "A").End(xlUp))
End With

For Each rng In rngToSearch
If Not (rng.Value Or rng.Offset(0, 1).Value) Then _
rng.EntireRow.Hidden = True
Next rng

End Sub
--
HTH...

Jim Thomlinson


"FA" wrote:

I have 2 columns in my spreadsheet that contain either True or False entries.
I'm looking to create a macro that will display the True entries from either
column.
If my sheet looks like this,

A B
1 True False
2 True False
3 False False
4 False True
5 False True

Then I want the macro to display only rows 1,2,4 & 5. The colums are never
both True so I don't have to worry about that.
I'm stuck with coming up with a function that will work, any help would be
appreciated!