G
Guest
In my spreadsheet, col. A contains quantities, col. B contains prices. In
column D, I have formulas multiplying quantity times price. Column D cells
are also formatted as currency, and they display $0.00 when no quantity is
present.
I've named col. D as a range ("HideRows"). My goal is to have my code
search my named range, and for each cell containing $0.00, if the
corresponding quantity cell is empty, hide the row. If the quantity is
entered as zero, I don't want the row to be hidden. My code is below, but it
is not recognizing my conditions. What am I missing? Thanks for your help!
Sub HidePLRows()
Dim cell As Range
Application.ScreenUpdating = False
Range("HideRows").Select
For Each cell In Range("HideRows")
If ActiveCell.Value = "$0.00" And ActiveCell.Offset(0, -3).Value = ""
Then
Selection.EntireRow.Hidden = True
Else
ActiveCell.Offset(1, 0).Select
End If
Next
Range("A14").Select
Application.ScreenUpdating = True
End Sub
column D, I have formulas multiplying quantity times price. Column D cells
are also formatted as currency, and they display $0.00 when no quantity is
present.
I've named col. D as a range ("HideRows"). My goal is to have my code
search my named range, and for each cell containing $0.00, if the
corresponding quantity cell is empty, hide the row. If the quantity is
entered as zero, I don't want the row to be hidden. My code is below, but it
is not recognizing my conditions. What am I missing? Thanks for your help!
Sub HidePLRows()
Dim cell As Range
Application.ScreenUpdating = False
Range("HideRows").Select
For Each cell In Range("HideRows")
If ActiveCell.Value = "$0.00" And ActiveCell.Offset(0, -3).Value = ""
Then
Selection.EntireRow.Hidden = True
Else
ActiveCell.Offset(1, 0).Select
End If
Next
Range("A14").Select
Application.ScreenUpdating = True
End Sub