Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default colour alternate rows in filtered list

In VBA, how would I change the interior colour of
alternate rows in a filtered list ie. visible rows only?

Thanks,
Rosemary
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default colour alternate rows in filtered list

Try this on Chip Pearsons site, it will give you all you need!

http://www.cpearson.com/excel.htm

You will find a section on colour formatting here.

Simo

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default colour alternate rows in filtered list

Hi
try the following:
- row 1 is the heading row
- column A is the filtered column
- select row 2:x
- goto 'Format - Conditional Format'
- enter the following formula:
=MOD(SUBTOTAL(3,$A$2:$A2),2)
- choose a fomat

-----Original Message-----
In VBA, how would I change the interior colour of
alternate rows in a filtered list ie. visible rows only?

Thanks,
Rosemary
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default colour alternate rows in filtered list


-----Original Message-----
Try this on Chip Pearsons site, it will give you all you

need!

http://www.cpearson.com/excel.htm

You will find a section on colour formatting here.

Simon


---
Message posted from http://www.ExcelForum.com/

.


Simon,


Thanks for your reply. I couldn't actually find what
I wanted on the site you pointed me to (I'm sure it was
there but I am probably too impatient/jaded to weed it out
(been working too hard recently!)) but did find useful
help at:
http://j-walk.com/ss/excel/usertips/tip043.htm

For the benefit of anyone else who wants to do something
similar, a solution is:

With Range(???).SpecialCells(xlCellTypeVisible)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW(),2)=0"
.FormatConditions(1).Interior.ColorIndex = ???
End With

Regards,
Rosemary
  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default colour alternate rows in filtered list


-----Original Message-----
Hi
try the following:
- row 1 is the heading row
- column A is the filtered column
- select row 2:x
- goto 'Format - Conditional Format'
- enter the following formula:
=MOD(SUBTOTAL(3,$A$2:$A2),2)
- choose a fomat

-----Original Message-----
In VBA, how would I change the interior colour of
alternate rows in a filtered list ie. visible rows only?

Thanks,
Rosemary
.

.

Frank,



  #6   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default colour alternate rows in filtered list


-----Original Message-----
Hi
try the following:
- row 1 is the heading row
- column A is the filtered column
- select row 2:x
- goto 'Format - Conditional Format'
- enter the following formula:
=MOD(SUBTOTAL(3,$A$2:$A2),2)
- choose a fomat

-----Original Message-----
In VBA, how would I change the interior colour of
alternate rows in a filtered list ie. visible rows only?

Thanks,
Rosemary
.

.

Frank

  #7   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default colour alternate rows in filtered list


-----Original Message-----
Hi
try the following:
- row 1 is the heading row
- column A is the filtered column
- select row 2:x
- goto 'Format - Conditional Format'
- enter the following formula:
=MOD(SUBTOTAL(3,$A$2:$A2),2)
- choose a fomat

-----Original Message-----
In VBA, how would I change the interior colour of
alternate rows in a filtered list ie. visible rows only?

Thanks,
Rosemary
.

.

Frank, thank you for your solution (3rd time lucky!). It
also works, though I don't really understand why. It also
causes some of the hidden rows to get coloured too, in
what appears a very random pattern ie. when the list is un-
filtered, I see that rows 2, 3, 7, 9, 10, 11 are
coloured, whereas when the list is filtered rows 2 7 and 9
are correctly coloured

Could you perhaps enlighten me as to how it works?
Thanks,
Rosemary
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default colour alternate rows in filtered list

Direct link to Chip's version:

http://www.cpearson.com/excel/banding.htm



wrote:

-----Original Message-----
Try this on Chip Pearsons site, it will give you all you

need!

http://www.cpearson.com/excel.htm

You will find a section on colour formatting here.

Simon


---
Message posted from http://www.ExcelForum.com/

.


Simon,

Thanks for your reply. I couldn't actually find what
I wanted on the site you pointed me to (I'm sure it was
there but I am probably too impatient/jaded to weed it out
(been working too hard recently!)) but did find useful
help at:
http://j-walk.com/ss/excel/usertips/tip043.htm

For the benefit of anyone else who wants to do something
similar, a solution is:

With Range(???).SpecialCells(xlCellTypeVisible)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW(),2)=0"
.FormatConditions(1).Interior.ColorIndex = ???
End With

Regards,
Rosemary


--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default colour alternate rows in filtered list

Sometimes, it's easier to see what happens if you use that conditional
formatting in a helper column of cells.

I added another column and plopped this into E2 (for me)
=MOD(SUBTOTAL(3,$A$2:$A2),2)

Then I dragged down to match the number of rows in the data.

You'll notice that when nothing is filtered, you get:
1,0,1,0,1,0,1.... (alternating 1's/0's)

Now filter that list:
The visible cells in that helper column still look like an alternating sequence
of 1,0,1,0,...

The =subtotal() function respects hidden cells (when hidden by an autofilter).

And =subtotal(3,$a$2:$a2)
counts (the 3 portion)
the number of cells that have something in them from A2 to the row you're in.

Note that if you used a column that somes contained empty cells (not formulas
that evaluated to ""), then you're formula will not work the way you want.


wrote:

-----Original Message-----
Hi
try the following:
- row 1 is the heading row
- column A is the filtered column
- select row 2:x
- goto 'Format - Conditional Format'
- enter the following formula:
=MOD(SUBTOTAL(3,$A$2:$A2),2)
- choose a fomat

-----Original Message-----
In VBA, how would I change the interior colour of
alternate rows in a filtered list ie. visible rows only?

Thanks,
Rosemary
.

.

Frank, thank you for your solution (3rd time lucky!). It
also works, though I don't really understand why. It also
causes some of the hidden rows to get coloured too, in
what appears a very random pattern ie. when the list is un-
filtered, I see that rows 2, 3, 7, 9, 10, 11 are
coloured, whereas when the list is filtered rows 2 7 and 9
are correctly coloured

Could you perhaps enlighten me as to how it works?
Thanks,
Rosemary


--

Dave Peterson

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default colour alternate rows in filtered list

Dave,

Thanks very much for taking the time to explain this
to me. I finally understand it.

Regards,
Rosemary
-----Original Message-----
Sometimes, it's easier to see what happens if you use

that conditional
formatting in a helper column of cells.

I added another column and plopped this into E2 (for me)
=MOD(SUBTOTAL(3,$A$2:$A2),2)

Then I dragged down to match the number of rows in the

data.

You'll notice that when nothing is filtered, you get:
1,0,1,0,1,0,1.... (alternating 1's/0's)

Now filter that list:
The visible cells in that helper column still look like

an alternating sequence
of 1,0,1,0,...

The =subtotal() function respects hidden cells (when

hidden by an autofilter).

And =subtotal(3,$a$2:$a2)
counts (the 3 portion)
the number of cells that have something in them from A2

to the row you're in.

Note that if you used a column that somes contained empty

cells (not formulas
that evaluated to ""), then you're formula will not work

the way you want.


wrote:

-----Original Message-----
Hi
try the following:
- row 1 is the heading row
- column A is the filtered column
- select row 2:x
- goto 'Format - Conditional Format'
- enter the following formula:
=MOD(SUBTOTAL(3,$A$2:$A2),2)
- choose a fomat

-----Original Message-----
In VBA, how would I change the interior colour of
alternate rows in a filtered list ie. visible rows

only?

Thanks,
Rosemary
.

.

Frank, thank you for your solution (3rd time lucky!). It
also works, though I don't really understand why. It

also
causes some of the hidden rows to get coloured too, in
what appears a very random pattern ie. when the list is

un-
filtered, I see that rows 2, 3, 7, 9, 10, 11 are
coloured, whereas when the list is filtered rows 2 7

and 9
are correctly coloured

Could you perhaps enlighten me as to how it works?
Thanks,
Rosemary


--

Dave Peterson

.

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
alternate row shading on filtered data wallyship Excel Discussion (Misc queries) 2 October 16th 09 07:11 AM
How do I count rows in a filtered list when using AutoFilter? chiefcook Excel Worksheet Functions 6 November 10th 08 09:21 AM
Alternate row shading with a filtered spreadsheet glenlee Excel Discussion (Misc queries) 5 December 9th 06 05:57 AM
Define a range containing the first 10 rows of a filtered list Marco Excel Worksheet Functions 3 October 7th 05 01:42 PM
HOW CAN I AUTOMATICALLY INSERT ALTERNATE BLANK ROWS IN A LIST? Phil A. Excel Discussion (Misc queries) 1 April 19th 05 04:10 PM


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