Solved

macro help

Posted on 2011-02-15
8
349 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
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…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

789 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