LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Color Rows

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Color alternate rows when after hiding selected rows Monk[_2_] Excel Worksheet Functions 6 June 7th 08 01:36 AM
How do I sort my data by color? (color applied to rows) TTownsend Excel Worksheet Functions 3 September 7th 06 09:49 PM
Color rows if bob Excel Worksheet Functions 1 January 29th 06 03:05 PM
how to insert and color these rows Faye[_2_] Excel Programming 0 September 13th 05 03:39 PM
Color rows Frank Kabel Excel Programming 0 May 5th 04 08:36 PM


All times are GMT +1. The time now is 07:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"