Link to home
Create AccountLog in
Avatar of mc7560
mc7560Flag for United States of America

asked on

macro help

Experts, attached is the code a friend wrote for me a while ago. Is it possible to add another condition to this code that checks another range(BD5:BD600) for the same thing as well? In other words, if a cell aq15=0 but bd15=10 then I don't want to hide that row. Pls let me know. tks.
mc

Application.ScreenUpdating = False

Dim cell As Range
Range("aq5:aq600").Select
For Each cell In Selection
If Not IsEmpty(cell) And cell.Value = 0 Then
cell.EntireRow.Hidden = True
End If
Next cell
Range("a1").Select
Application.ScreenUpdating = True
Avatar of Anthony2oo5
Anthony2oo5

Application.ScreenUpdating = False

Dim cell As Range
Range("aq5:aq600").Select
For Each cell In Selection
If Not IsEmpty(cell) And cell.Value = 0 Then
cell.EntireRow.Hidden = True
End If
Next cell

Range("BD5:BD600").Select
For Each cell In Selection
If Not IsEmpty(cell) And cell.Value = 0 Then
cell.EntireRow.Hidden = True
End If
Next cell

Range("a1").Select
Application.ScreenUpdating = True
Dim cell As Range
Range("aq5:aq600").Select
For Each cell In Selection
If (Not IsEmpty(cell) And cell.Value = 0) and (Not IsEmpty(cell.offset(0,13)) And cell.offset(0,13).Value = 0) Then
cell.EntireRow.Hidden = True
End If
Next cell
Range("a1").Select
Application.ScreenUpdating = True
ASKER CERTIFIED SOLUTION
Avatar of StephenJR
StephenJR
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Anthony, author wants an "inclusive" condition, I think?
Avatar of mc7560

ASKER

Stephen, thanks that did it. Have a great day.
Any reason why mine was treated any differently? Its exactly the same!
Thank you mc7560, glad it worked, but Runrigger posted the same solution ...
Not worried about the pionts, but worth making a note of any error should future queries be made on this subject.