PC Review


Reply
Thread Tools Rate Thread

Colour rows based on value

 
 
Martin
Guest
Posts: n/a
 
      8th May 2009
Hello,

I have this code that almost works but just need some help. This looks at
the value of each row, column 3 and colours the entire row with shade 36 if
the cell value is different to the row above (still column 3). However when
the change takes place in column 3 it doesnt shade that row but it shades all
others. So I am almost there but stumped why it does this.

Can anyone help?

Dim lRow As Long
Dim lCol As Long

For lRow = 2 To 9216

If Cells(lRow, 3).Value = Cells(lRow - 1, 3) Then
If IsEmpty(Cells(lRow, 256)) Then
lCol = Cells(lRow, 256).End(xlToLeft).Column
Else
lCol = 256
End If
Range(Cells(lRow, 1), Cells(lRow, lCol)).Interior.ColorIndex = 36
End If
Next

Thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Colour rows based on value Bob Phillips Microsoft Excel Programming 1 8th May 2009 12:16 PM
Colour Rows in Datasheet based on three criteria PMK Microsoft Access 1 17th Dec 2007 08:24 PM
copy rows based on cell colour K Microsoft Excel Programming 4 15th Dec 2007 06:25 PM
copy rows based on cell colour K Microsoft Excel Programming 1 13th Dec 2007 11:04 PM
Hide rows based on colour Ozzie via OfficeKB.com Microsoft Excel Programming 3 19th Jan 2007 03:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:30 PM.