Hide row based on values in two different columns


Posted by Adrae on December 06, 2001 2:24 PM

I want to set up a macro that will hide rows if column D = "" AND column Q = 0. Is there any way I can turn the code below to incorporate the second condition (column Q)

Application.ScreenUpdating = False
Sheets("Notes").Select
Dim cell as string
With Range("D12:D800")
.EntireRow.Hidden = False
For Each cell In Range("D12:D" & ActiveCell.SpecialCells(xlCellTypeLastCell).Row)
Select Case cell.Value
Case Is = ""
cell.EntireRow.Hidden = True
End Select
Next cell
End With

Thanks :-)

Posted by Perdita on December 06, 2001 5:54 PM


Application.ScreenUpdating = False
Dim LR As Long, rng As Range, Cell As Range
With Sheets("Notes")
LR = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set rng = .Range("D12:D" & LR)
End With
rng.EntireRow.Hidden = False
For Each Cell In rng
If Cell.Value = "" And Cell.Offset(0, 13).Value = "0" Then
Cell.EntireRow.Hidden = True
End If
Next Cell




Posted by Adrae on December 06, 2001 7:55 PM

Perfect!!! Thanks :-)

Thanks!!!