[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

macro help

Posted on 2011-02-15
8
Medium Priority
?
354 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 2000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

656 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