Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Colour rows based on value

Works fine for me. What do you mean when you say that ... when the change
takes place?

--
__________________________________
HTH

Bob

"Martin" wrote in message
...
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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default Colour rows based on value

Sorry. I mean for example column 3 row 4 to 8 is different to column 3 row 3
then that row is not coloured but row 5 to 8 is. So it misses out the first
row of where the change takes place

"Bob Phillips" wrote:

Works fine for me. What do you mean when you say that ... when the change
takes place?

--
__________________________________
HTH

Bob

"Martin" wrote in message
...
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
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
copy rows based on cell colour by conditional formating K[_2_] Excel Programming 8 December 15th 07 07:18 PM
copy rows based on cell colour K[_2_] Excel Programming 4 December 15th 07 06:25 PM
copy rows based on cell colour K[_2_] Excel Programming 1 December 13th 07 11:04 PM
Hide rows based on colour Ozzie via OfficeKB.com Excel Programming 3 January 19th 07 03:24 PM
Assign a particular colour to rows based on their current status Co-op Bank Excel Programming 2 March 17th 06 10:27 AM


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

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

About Us

"It's about Microsoft Excel"