+ Reply to Thread
Results 1 to 3 of 3

How to find particular instances and make those lines highlighted

Hybrid View

  1. #1
    Registered User
    Join Date
    07-08-2008
    Location
    Durham, NC
    Posts
    10

    How to find particular instances and make those lines highlighted

    I want Excel to find any instance in which there is a 0 in one cell and then a value greater than 0 in the cell immediately to the right. Then, I want Excel to highlight the row in which that occurs.

    For instance, if there is a row:
    56 89 0 76 32
    then it should be highlighted because there is a value greater than 0 (76) in the cell to the right of the 0.

    How can I make this happen?

    Thanks in advance for the help.

  2. #2
    Registered User
    Join Date
    07-07-2008
    Location
    VA
    MS-Off Ver
    2007
    Posts
    38
    Quote Originally Posted by girlofscience
    I want Excel to find any instance in which there is a 0 in one cell and then a value greater than 0 in the cell immediately to the right. Then, I want Excel to highlight the row in which that occurs.

    For instance, if there is a row:
    56 89 0 76 32
    then it should be highlighted because there is a value greater than 0 (76) in the cell to the right of the 0.

    How can I make this happen?

    Thanks in advance for the help.
    You could index-match which column the zero is in and upon finding out that information you can determine if the cell immediately to the right is greater than zero by an if function. Use conditional formatting to have automatic highlights.

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi,Girlofscience
    Try this:-
    Dim Rng As Range, cl As Range
    
    Set Rng = ActiveSheet.UsedRange
        For Each cl In Rng
            If cl = "0" And cl.Offset(, 1) > "0" Then
                cl.EntireRow.Interior.ColorIndex = 15
            End If
        Next cl
    Regards Mick

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1