Solved

macro help

Posted on 2011-02-15
8
347 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
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
 
LVL 11

Expert Comment

by:Runrigger
ID: 34898122
Anthony, author wants an "inclusive" condition, I think?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now