Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Alternating Changing Color of Cells (a Range) across a Spreadsheet

Hi again

I want to be able to change the color of a range of cells across a
spreadsheet alternating the colors ie

Range(A1,H1) - Pale Blue then Range(I1,N1) Pale yellow then Range(O1,S1)
Pale Blue and so on....

Any advice on this simple idea? I was hoping to be able to do something like
Range(A1,H1).BackColor = RGB(192, 255, 255)
but I think that was wishfull thinking...

cheers
Jeff


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Alternating Changing Color of Cells (a Range) across a Spreadsheet

Hi Jeff,

Using conditional formatting , Formula Is :
=MOD(ROW(),2)=0
and pick your color ...

HTH
Carim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Alternating Changing Color of Cells (a Range) across a Spreadsheet

Hi Jeff,

Change
Range(A1,H1).BackColor = RGB(192, 255, 255)

to
Range("A1,H1").Interior.Color = RGB(192, 255, 255)

or if you mean cells A1 to H1 ?

Range("A1:H1").Interior.Color = RGB(192, 255, 255)

Note when you apply a RGB color the eventual color will be will be matched
to the closest colour that exists in the palette. In the case of a default
palette your colour will applied as RGB(204, 255, 255), namely colorindex 20
one of the chart colours not shown in the normal dropdown (duplicated with
colorindex 34 in the "upper" part of the palette).

If you particularly want your own RGB customize one of the palette colours,
eg
Activeworkbook.colors(35) = RGB(192, 255, 255)

If your code always works with a similar palette, whether or not customized,
you could do -
Range("A1,H1").Interior.colorindex = 34

I don't follow what you mean by "and so on...."
There's no consistency in your column numbers accross like say every 5 cells
or every 5th cell, or do you mean repeat down rows and each row the same.
Perhaps you mean -

Range("A:A,H:H"). or Range("A:H").

Or if you want to format alternate rows Carim's suggestion works well.

Regards,
Peter T


"jeff" <jeff@work wrote in message
...
Hi again

I want to be able to change the color of a range of cells across a
spreadsheet alternating the colors ie

Range(A1,H1) - Pale Blue then Range(I1,N1) Pale yellow then Range(O1,S1)
Pale Blue and so on....

Any advice on this simple idea? I was hoping to be able to do something

like
Range(A1,H1).BackColor = RGB(192, 255, 255)
but I think that was wishfull thinking...

cheers
Jeff




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Alternating Changing Color of Cells (a Range) across a Spreadsheet

Peter

You have hit the nail on the head!! I was inaccurate with my column
examples, so i may have confused the issue ... but essentially its the
Interior.Color which I was looking for...

thanks again..
jeff


"Peter T" <peter_t@discussions wrote in message
...
Hi Jeff,

Change
Range(A1,H1).BackColor = RGB(192, 255, 255)

to
Range("A1,H1").Interior.Color = RGB(192, 255, 255)

or if you mean cells A1 to H1 ?

Range("A1:H1").Interior.Color = RGB(192, 255, 255)

Note when you apply a RGB color the eventual color will be will be matched
to the closest colour that exists in the palette. In the case of a default
palette your colour will applied as RGB(204, 255, 255), namely colorindex
20
one of the chart colours not shown in the normal dropdown (duplicated with
colorindex 34 in the "upper" part of the palette).

If you particularly want your own RGB customize one of the palette
colours,
eg
Activeworkbook.colors(35) = RGB(192, 255, 255)

If your code always works with a similar palette, whether or not
customized,
you could do -
Range("A1,H1").Interior.colorindex = 34

I don't follow what you mean by "and so on...."
There's no consistency in your column numbers accross like say every 5
cells
or every 5th cell, or do you mean repeat down rows and each row the same.
Perhaps you mean -

Range("A:A,H:H"). or Range("A:H").

Or if you want to format alternate rows Carim's suggestion works well.

Regards,
Peter T


"jeff" <jeff@work wrote in message
...
Hi again

I want to be able to change the color of a range of cells across a
spreadsheet alternating the colors ie

Range(A1,H1) - Pale Blue then Range(I1,N1) Pale yellow then Range(O1,S1)
Pale Blue and so on....

Any advice on this simple idea? I was hoping to be able to do something

like
Range(A1,H1).BackColor = RGB(192, 255, 255)
but I think that was wishfull thinking...

cheers
Jeff






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
Changing color of a range of cells dending up on a value in anothr Srajes New Users to Excel 1 June 16th 09 01:35 AM
changing a range of cells throughout a 5 page spreadsheet Midwest Farmers Excel Discussion (Misc queries) 1 October 21st 08 07:39 PM
How do I set an auto alternating row color? Daniel Stephens Excel Discussion (Misc queries) 2 July 19th 05 05:22 PM
macro or vb to alternating row color mgm[_3_] Excel Programming 5 February 13th 04 06:44 PM
Changing color on a range of cells Pete Excel Programming 3 December 31st 03 10:03 PM


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