Closed Thread
Results 1 to 2 of 2

code syntax

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    code syntax

    Can you please modify the code below, especially the IF statement (should be if any value in J2:J is <=120 or Yellow Then D2:D is Red). Also, is the reads code correct? Thank you very much.

     Sub QC()
        Dim rngCell As Range
        Dim i As Long
        Application.ScreenUpdating = False
    'Coverage code
        i = Range("J" & Rows.Count).End(xlUp).Row
        For Each rngCell In Range("J2:E" & i)
            Select Case rngCell.Value
                Case Is <= 120
                    rngCell.Interior.Color = RGB(255, 255, 0) 'Yellow
       IFF J2:J="Yellow" Then ("D2:D" & i)
                    rngCell.Interior.Color = RGB(255, 0, 0) 'Red
                            End Select
        Next rngCell
        
        'Reads code
        i = Range("H+I" & Rows.Count).End(xlUp).Row
        For Each rngCell In Range("H2:H + I2:I" & i)
            Select Case rngCell.Value
                Case Is <= 120
                    rngCell.Interior.Color = RGB(255, 204, 0) 'Orange
            End Select
        Next rngCell
        End With
        
            Application.ScreenUpdating = True
    
     End Sub

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: code syntax

    You already received a solution here, why did you post this thread again here - http://www.excelforum.com/excel-prog...-columns.html?

    I am moving this solution to the other thread and this thread is duplicate, hence closed.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed 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