Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Format a Filtered range's header?


Hi, and many thanks in advance!


Say I have a range "range("A1").currentregion named Rng


say Rng is filtered


is it posible to change the formatting of Rng'headers if the filter i
ON

eg: Rng.AutoFilter Field:=3, Criteria1:="Europe"

I mean, if A1=Country B1=Population C1=Continent

If I chose in C1 the filter criteria Europe, then C1 must be Yellow
then if i say in A1=Spain A1 must be yellow


then if i take out the filters A1:C1 must be without colour.
I mean:
Rng.AutoFilter Field:=3
Rng.AutoFilter Field:=2
Rng.AutoFilter Field:=1

I am trying to do this because the blue colour showed in the dropdow
control when pressed is not enought.
so I would like to make it ckear if a filter is benn Pressed!

Any idea????????

--
0000_AAAA_000
-----------------------------------------------------------------------
0000_AAAA_0000's Profile: http://www.excelforum.com/member.php...fo&userid=1248
View this thread: http://www.excelforum.com/showthread.php?threadid=26650

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Format a Filtered range's header?

Private Sub Worksheet_Calculate()
Dim f As Filter
If Me.AutoFilterMode = True Then
i = 0
For Each f In Me.AutoFilter.Filters
i = i + 1
If f.On Then
Cells(1, i).Interior.ColorIndex = 6
Else
Cells(1, i).Interior.ColorIndex = xlNone
End If
Next
Else
Rows(1).Interior.ColorIndex = xlNone
End If
End Sub

right click on the sheet tab and select view code. Place this code in that
module.

This only works if changing the filter causes a calculate. You can force
this by having at least one formula refer to a cell within the filter range.
A good formula might be to put this to the right of the header of the last
column in the filter range.

=SubTotal(3,$A2:$A30)

or make it

="Visible Rows: " & SubTotal(3,$A$2:$A$30)

Where the range $A$2:$A$30 would span the filter range.

--
Regards,
Tom Ogilvy



"0000_AAAA_0000" wrote in
message ...

Hi, and many thanks in advance!


Say I have a range "range("A1").currentregion named Rng


say Rng is filtered


is it posible to change the formatting of Rng'headers if the filter is
ON

eg: Rng.AutoFilter Field:=3, Criteria1:="Europe"

I mean, if A1=Country B1=Population C1=Continent

If I chose in C1 the filter criteria Europe, then C1 must be Yellow
then if i say in A1=Spain A1 must be yellow


then if i take out the filters A1:C1 must be without colour.
I mean:
Rng.AutoFilter Field:=3
Rng.AutoFilter Field:=2
Rng.AutoFilter Field:=1

I am trying to do this because the blue colour showed in the dropdown
control when pressed is not enought.
so I would like to make it ckear if a filter is benn Pressed!

Any idea?????????


--
0000_AAAA_0000
------------------------------------------------------------------------
0000_AAAA_0000's Profile:

http://www.excelforum.com/member.php...o&userid=12480
View this thread: http://www.excelforum.com/showthread...hreadid=266501



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
How do i change column header from R[1] C format to A1 format? lovnlife Excel Discussion (Misc queries) 4 April 5th 10 07:29 PM
Copy and Paste Format in filtered rows XLFanatico Excel Discussion (Misc queries) 6 July 24th 09 05:53 PM
questions regarding range's trav Excel Discussion (Misc queries) 3 February 24th 06 06:06 PM
questions regarding range's trav Excel Discussion (Misc queries) 0 February 23rd 06 11:01 PM
Application or Object Defined Error when trying to change a Range's text Wes Lee Excel Programming 2 September 19th 03 06:39 PM


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