Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
This VBA hilites 5 rows, I need the last two rows to be a different color, an color As of now all rows are a light green Sub Worksheet_SelectionChange(ByVal Target As Range) Dim Cell As Range Dim i As Long Dim iPos As Long Me.Cells.Interior.ColorIndex = xlColorIndexNone For Each Cell In Target.EntireRow.Cells For i = 1 To 4 iPos = 0 On Error Resume Next iPos = Application.Match(Cell.Value, Rows(Target.Row + i), 0) On Error GoTo 0 If iPos < 0 Then 'return_type' is 1 Cells(Target.Row + i, iPos).Interior.ColorIndex = 35 Cell.Interior.ColorIndex = 35 End If Next i If Range("A1").Value = 0 Then Exit Sub Next Cell End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Color alternate rows when after hiding selected rows | Excel Worksheet Functions | |||
How do I sort my data by color? (color applied to rows) | Excel Worksheet Functions | |||
Color rows if | Excel Worksheet Functions | |||
how to insert and color these rows | Excel Programming | |||
Color rows | Excel Programming |