PC Review


Reply
Thread Tools Rate Thread

Alternating background row colour

 
 
Davie
Guest
Posts: n/a
 
      29th May 2006
I have a spreadsheet with a list of outlet names and various associated
information. I want to have an alternating background colour when the name
changes. For example

Name Details
abc this is the details
abc more details
abc even more details
xyz xyz details
xyz more details
test test


so for the above example, the background colour of abc would be the same,
then it would alternate when the name changes to xyz, and then change again
for test. The spreadsheet i have has several tens of thousands of entries
and cannot be done manually. Any suggestions?

Thanks in advance.


 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      29th May 2006
There is the free Excel add-in "Shade Data Rows" at my website that
shades rows by value or by every nth row. You can use any color
in the Excel color palette. It should do what you want. Download from...
http://www.realezsites.com/bus/primitivesoftware

Jim Cone
San Francisco, USA


"Davie" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
I have a spreadsheet with a list of outlet names and various associated
information. I want to have an alternating background colour when the name
changes. For example

Name Details
abc this is the details
abc more details
abc even more details
xyz xyz details
xyz more details
test test


so for the above example, the background colour of abc would be the same,
then it would alternate when the name changes to xyz, and then change again
for test. The spreadsheet i have has several tens of thousands of entries
and cannot be done manually. Any suggestions?

Thanks in advance.


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      29th May 2006
A macro to do it

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

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
vVal = Range("A2").Value
ci = 35
For i = 2 To iLastRow
If Cells(i, "A").Value <> vVal Then
If ci = 35 Then
ci = xlColorIndexNone
Else
ci = 35
End If
vVal = Cells(i, "A").Value
End If
Rows(i).Interior.ColorIndex = ci
Next i

End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)

"Davie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a spreadsheet with a list of outlet names and various associated
> information. I want to have an alternating background colour when the

name
> changes. For example
>
> Name Details
> abc this is the details
> abc more details
> abc even more details
> xyz xyz details
> xyz more details
> test test
>
>
> so for the above example, the background colour of abc would be the same,
> then it would alternate when the name changes to xyz, and then change

again
> for test. The spreadsheet i have has several tens of thousands of entries
> and cannot be done manually. Any suggestions?
>
> Thanks in advance.
>
>



 
Reply With Quote
 
Ardus Petus
Guest
Posts: n/a
 
      29th May 2006
With a staging column (say in column C)
Enter in C2
=IF(A2=A1,C1+1,C1)
and drag down

Select all cells
Format>Conditional Format
Formula: =MOD(C1,2)=1
Select format, background shading you like

Et voilà!

HTH
--
AP

"Davie" <(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed)...
>I have a spreadsheet with a list of outlet names and various associated
>information. I want to have an alternating background colour when the name
>changes. For example
>
> Name Details
> abc this is the details
> abc more details
> abc even more details
> xyz xyz details
> xyz more details
> test test
>
>
> so for the above example, the background colour of abc would be the same,
> then it would alternate when the name changes to xyz, and then change
> again for test. The spreadsheet i have has several tens of thousands of
> entries and cannot be done manually. Any suggestions?
>
> Thanks in advance.
>



 
Reply With Quote
 
Davie
Guest
Posts: n/a
 
      29th May 2006
Thanks very much guys! It's appreciated.


"Bob Phillips" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>A macro to do it
>
> Sub Test()
> Dim iLastRow As Long
> Dim i As Long
> Dim ci As Long
> Dim vVal
>
> iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
> vVal = Range("A2").Value
> ci = 35
> For i = 2 To iLastRow
> If Cells(i, "A").Value <> vVal Then
> If ci = 35 Then
> ci = xlColorIndexNone
> Else
> ci = 35
> End If
> vVal = Cells(i, "A").Value
> End If
> Rows(i).Interior.ColorIndex = ci
> Next i
>
> End Sub
>
>
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with googlemail if mailing direct)
>
> "Davie" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I have a spreadsheet with a list of outlet names and various associated
>> information. I want to have an alternating background colour when the

> name
>> changes. For example
>>
>> Name Details
>> abc this is the details
>> abc more details
>> abc even more details
>> xyz xyz details
>> xyz more details
>> test test
>>
>>
>> so for the above example, the background colour of abc would be the same,
>> then it would alternate when the name changes to xyz, and then change

> again
>> for test. The spreadsheet i have has several tens of thousands of
>> entries
>> and cannot be done manually. Any suggestions?
>>
>> Thanks in advance.
>>
>>

>
>



 
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
Colour alternating tabs? StargateFanNotAtHome Microsoft Excel Programming 5 20th Aug 2009 04:57 AM
colour rows alternating colour =?Utf-8?B?R3Jk?= Microsoft Excel Misc 6 13th Nov 2007 10:48 PM
Alternating row colour according to month =?Utf-8?B?U2FyYWggKE9HSSk=?= Microsoft Excel Misc 2 17th May 2007 01:11 PM
alternating cell colour mohd21uk via OfficeKB.com Microsoft Excel New Users 2 12th May 2006 12:17 PM
Continuous Form / Alternating Row/Record Colour? =?Utf-8?B?QnJvb2s=?= Microsoft Access Forms 2 6th Dec 2005 04:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:08 AM.