Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
mohd21uk via OfficeKB.com
 
Posts: n/a
Default alternating cell colour

I have a spreadsheet where column A has a set of different values. I would
like to alternate the cell colour for changing values.
For e.g

210 - Cell Colour Green
210 - Cell Colour Green
210 - Cell Colour Green
215 - Cell Colour Blue
215 - Cell Colour Blue
220 - Cell Colour Green
221 - Cell Colour Blue
e.t.c

I would be grateful if you could provide me a macro that would do just this.

--
Message posted via http://www.officekb.com
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Bob Phillips
 
Posts: n/a
Default alternating cell colour

Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim ci As Long

ci = 10
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A1").Interior.ColorIndex = ci
For i = 2 To iLastRow
If Cells(i, "A").Value < Cells(i - 1, "A").Value Then
ci = IIf(ci = 10, 5, 10)
End If
Cells(i, "A").Interior.ColorIndex = ci
Next i

End Sub

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"mohd21uk via OfficeKB.com" <u20517@uwe wrote in message
news:60227df919109@uwe...
I have a spreadsheet where column A has a set of different values. I would
like to alternate the cell colour for changing values.
For e.g

210 - Cell Colour Green
210 - Cell Colour Green
210 - Cell Colour Green
215 - Cell Colour Blue
215 - Cell Colour Blue
220 - Cell Colour Green
221 - Cell Colour Blue
e.t.c

I would be grateful if you could provide me a macro that would do just

this.

--
Message posted via http://www.officekb.com



  #3   Report Post  
Posted to microsoft.public.excel.newusers
Jim Cone
 
Posts: n/a
Default alternating cell colour

The free Excel add-in 'Shade Data Rows' could do what you want.
Download from... http://www.realezsites.com/bus/primitivesoftware
--
Jim Cone
San Francisco, USA


"mohd21uk via OfficeKB.com" <u20517@uwe wrote in message news:60227df919109@uwe...
I have a spreadsheet where column A has a set of different values. I would
like to alternate the cell colour for changing values.
For e.g
210 - Cell Colour Green
210 - Cell Colour Green
210 - Cell Colour Green
215 - Cell Colour Blue
215 - Cell Colour Blue
220 - Cell Colour Green
221 - Cell Colour Blue
e.t.c
I would be grateful if you could provide me a macro that would do just this.
--
Message posted via http://www.officekb.com
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
Conditional Format as a MACRO Gunjani Excel Worksheet Functions 3 March 29th 06 05:22 PM
Changing cell colour depending on another cells value... Web master Excel Discussion (Misc queries) 3 January 10th 06 12:30 PM
Fill colour a cell from the linked cell Stephen C Excel Discussion (Misc queries) 1 September 28th 05 03:56 PM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
Function to return colour of formatted cell ExcelMonkey Excel Worksheet Functions 3 November 1st 04 05:54 PM


All times are GMT +1. The time now is 02:25 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"