Solved

Code Not HIghlighting Rows properly

Posted on 2014-01-21
3
315 Views
Last Modified: 2014-01-21
I did not write this code.  It is meant to highlight every row if cell in Column P is not null.
It is only hightlighting some rows.  It highlighted a row with (77.01) but did not highlight one with 50.05.
I need for it to highlighted rows where cells in column P are not null.  Thanks in advance.  Using Excel 2010 also.

Dim x As Long
        For x = 11 To row - 1
            If (Range("P" & x).Value > 0.05 Or Range("P" & x).Value < -0.05) And (Range("N" & x).Value <> "None") Then
                With Range(x & ":" & x).Interior
                    .Pattern = xlSolid
                    .PatternColorIndex = xlAutomatic
                    .Color = 65535
                    .TintAndShade = 0
                    .PatternTintAndShade = 0
                End With
            End If
        Next
    End If
0
Comment
Question by:leezac
3 Comments
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39797970
why not conditional format?
also try Range("N" & x).Value <> "")
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39798022
This will not highlight the row which has "None" in column N
0
 

Author Closing Comment

by:leezac
ID: 39798050
I checked and am taking the color coding out.  Thanks.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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.

813 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