Solved

Excel: Macro Formula (double If?)

Posted on 2014-11-02
2
82 Views
Last Modified: 2014-11-02
Hello,

Below is my current macro formula

Sheets("3 Month Letter").Select
For Idx = RowCount To 2 Step -1
    If Range("O" & Idx).Value = 2 Then
        Range("O" & Idx).EntireRow.Delete
    End If
Next

Open in new window


Currently the rows will be deleted if the value = 2. I would also like the row deleted it the row is '#N/A'. How to I append this to the above formula?

Cheers.
0
Comment
Question by:dabug80
2 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40418861
Hi,

pls try

For Idx = RowCount To 2 Step -1
    If IsError(Range("O" & Idx).Value) Then
        If Range("O" & Idx).Value = CVErr(xlErrNA) Then Range("O" & Idx).EntireRow.Delete
    ElseIf Range("O" & Idx).Value = 2 Then
    Range("O" & Idx).EntireRow.Delete
    End If
Next

Open in new window

Regards
0
 
LVL 1

Author Closing Comment

by:dabug80
ID: 40418863
Thanks for your help
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

Title # Comments Views Activity
Create a Dynamic Dropdown List in Excel excluding Blanks 5 35
Sum Based On Criteriya 7 19
Boolean help 6 27
Fixing a embedded format 7 29
Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

914 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

14 Experts available now in Live!

Get 1:1 Help Now