Consulting

Results 1 to 2 of 2

Thread: Changing color of part of Row if condition met

  1. #1

    Changing color of part of Row if condition met

    Hello, I'm working on a macro to change the color of the row between column W to AN if in column K the value is "FCA" (without quotes).
    So far I have this, but it doesn't work:

    [VBA]

    Sub Test()

    For Each cell In Range("K1", Cells(Rows.Count,
    "K").End(xlUp))
    If InStr(1, cell, "FCA")
    Then
    Range("W" & cell.Row & ":AN" &
    cell.Row).Interior.ColorIndex = 3
    End If
    Next
    cell

    [/VBA]

  2. #2
    VBAX Mentor
    Joined
    Jul 2012
    Posts
    398
    Location
    [vba]Sub Test()
    LR = Cells(Rows.Count, "K").End(xlUp).Row
    For Each cell In Range("K1:K" & LR)
    If InStr(cell, "FCA") > 0 Then
    Range("W" & cell.Row & ":AN" & cell.Row).Interior.ColorIndex = 3
    End If
    Next cell
    end sub[/vba]

Posting Permissions

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