Solved

macro help

Posted on 2011-02-15
8
351 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:mc7560
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:Anthony2oo5
ID: 34898049
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
0
 
LVL 11

Expert Comment

by:Runrigger
ID: 34898097
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
0
 
LVL 24

Accepted Solution

by:
StephenJR earned 500 total points
ID: 34898102
This perhaps?
Sub x()

Application.ScreenUpdating = False

Dim cell As Range

For Each cell In Range("aq5:aq600")
    If Not IsEmpty(cell) And cell.Value = 0 And Not IsEmpty(cell.Offset(, 13)) And cell.Offset(, 13).Value = 0 Then
        cell.EntireRow.Hidden = True
    End If
Next cell

Application.ScreenUpdating = True

End Sub

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:Runrigger
ID: 34898122
Anthony, author wants an "inclusive" condition, I think?
0
 

Author Closing Comment

by:mc7560
ID: 34898242
Stephen, thanks that did it. Have a great day.
0
 
LVL 11

Expert Comment

by:Runrigger
ID: 34898258
Any reason why mine was treated any differently? Its exactly the same!
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34898266
Thank you mc7560, glad it worked, but Runrigger posted the same solution ...
0
 
LVL 11

Expert Comment

by:Runrigger
ID: 34898271
Not worried about the pionts, but worth making a note of any error should future queries be made on this subject.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question