Hi
The code (both Debra's original, and my modified) works fine for me.
As Bernie says, are you sure that you have pasted into the Sheet, and not in
a regular module.
In the immediate window of the VBE (press Control+G if it is not visible)
type
Application.EnableEvents = True and then press Enter
Click back to your sheet, and see if it works for you then.
If you are still having a problem, send me an email, and I will post the
file to you.
Send to
roger at technology4u dot co dot uk
Do the obvious thing with dot and at.
--
Regards
Roger Govier
wrote in message
ps.com...
On Sep 10, 11:39 am, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Obviously, the code worked for me.
Do you have events disabled?
If so, use this macro:
Sub ReEnable()
Application.EnableEvents = True
End Sub
Did you put the code into a regular code module or into the window that
appeared when you r-clicked
and chose "View Code"?
HTH,
Bernie
MS Excel MVP
wrote in
glegroups.com...
On Sep 10, 10:58 am, "Roger Govier" <rogerattechnology4NOSPAMu.co.uk
wrote:
Hi
Whilst the following suggestion won't change the selection, it may
help
users to recognise that a filter has already been set. Although the
small
arrow on the filter button turns blue when selection is on, this is
hard to
see.
Debra Dalgleish has several downloadable example sheets on her site,
where
the cell containing the heading becomes coloured if a filter is
applied.
Users could be told that not more than one heading should be coloured
for
their selection to be correct.
http://www.contextures.com/FilterColour.zip
--
Regards
Roger Govier
wrote in message
oups.com...
Hello,
I have an Excel 2003 file with 8 columns that one could filter on.
The AutoFilter function is set to ON. I have found that the users
do
not always remember to click on (All) in the filter drop down menu
before moving to the next column and filtering...they end up with
narrowing down on their filter choices when all they wanted to do
was
filter exclusively on the next column criteria.
With this dataset, there will never be a need to narrow
down...Hence,
how do I make it so that if one moves to another column to filter,
it
automatically sets everything back to (All)? There are way too many
users to train to select (All) every time they move to a different
column to filter on a different subject so a solution here would be
of
great help!
Sargum- Hide quoted text -
- Show quoted text -
Hi Roger,
I like this suggestion a lot and have added the code...I right-clicked
and chose "View Code" and pasted. However, similar to Bernie's code,
nothing happened. Is there something else I am supposed to do after I
paste the code and close VB? I must be missing something here since
both yours and Bernie's code have not worked for me yet. I will play
around with it.
Sargum- Hide quoted text -
- Show quoted text -
Hi all,
Still have had no luck getting the code to work. Have enabled macros,
changed security level to medium, did right click and choose "view
code" and paste into window. This is the code I have put in:
Sub ReEnable()
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Calculate()
'rem Code created by Debra Dalgleish
'modified by Roger Govier
Dim af As AutoFilter
Dim fFilter As Filter
Dim iFilterCount As Integer
If ActiveSheet.AutoFilterMode Then
' additional lines of code inserted here
Set af = ActiveSheet.AutoFilter
iFilterCount = 0
For Each fFilter In af.Filters
If fFilter.On Then iFilterCount = iFilterCount + 1
Next
If iFilterCount 1 Then
Rows(1).EntireRow.Interior.ColorIndex = xlNone
ActiveSheet.ShowAllData
Exit Sub
End If
'additional lines end here
Set af = ActiveSheet.AutoFilter
iFilterCount = 1
For Each fFilter In af.Filters
If fFilter.On Then
af.Range.Cells(1, iFilterCount) _
.Interior.ColorIndex = 6
Else
af.Range.Cells(1, iFilterCount) _
.Interior.ColorIndex = xlNone
End If
iFilterCount = iFilterCount + 1
Next fFilter
Else
Rows(1).EntireRow.Interior.ColorIndex = xlNone
End If
End Sub