Results 1 to 5 of 5

Color rows using VBA

Threaded View

  1. #1
    Registered User
    Join Date
    03-23-2010
    Location
    Melbourne Australia Down Under
    MS-Off Ver
    Excel 2010
    Posts
    56

    Color rows using VBA

    Hi

    I seek a bit of help with the code below.
    Sub PriorityRating()
        On Error Resume Next
        Dim J As Integer        'J represents COLUM,
        Dim R_From As Integer
        Dim R_To As Integer
    
        A = 1
        J = 10
        K = 11
    
        R_From = 11
        R_To = Sheets("RTO Performace Details").[b65536].End(3).Row
    
        Sheets("RTO Performace Details").Select
    
        For R = R_From To R_To
    
    
            If Cells(R, J).Value = "NON COMPLIANCE" Then
                Cells(R, A).Value = "1"
                Cells(R, A).Font.ColorIndex = 3        'Red
                Cells(R, J).Font.ColorIndex = 3        'Red
            End If
    
            '        If Cells(R, J).Value = "COMPLIANCE" Then
            '            Cells(R, A).Value = "2"
            '            Cells(R, A).Font.ColorIndex = 5    'Blue
            '            Cells(R, J).Font.ColorIndex = 5    'Blue
            '        End If
    
    '        If Cells(R, K).Value > 0 Then
    '            Cells(R, A).Value = ""
    '            Cells(R, A).Font.ColorIndex = 0        'Black
    '            Cells(R, K).Font.ColorIndex = 0        'Black
    '        End If
        Next R
    
    End Sub
    What I would like to achieve is that when the code runs I would like is have the font in the entire row changed to RED where column J has a value of “NON COMPLIANCE”
    I have also attached a copy of my spreadsheet

    Many thanks
    Attached Files Attached Files
    Have a great day!!!!

    Lou

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