Refreshing the displayed rows

  • Thread starter Thread starter BruceJ
  • Start date Start date
B

BruceJ

How do I get excel to refresh the displayed rows when a filter is applied?

Example
Col1 Col2
1 2
2 2
3 2
4 2


If I create a filter that say show COL1 > 2
it should show me 3 and 4

If I replace 3 with 0
It then shows me 0 and 4

But I would like to "refresh" so it only shows me 4

How can I do this?

Thanks
Bruce
 
The following code can be pasted onto the worksheet module (right-click
the sheet tab, choose View Code, paste where the cursor is flashing)

It will filter column 1, using the existing filter criteria.

'=======================
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 1 Then
Application.EnableEvents = False
Dim ws As Worksheet
Set ws = ActiveSheet
If ws.FilterMode = False Then
MsgBox "No Active Filter"
GoTo WC_Exit
End If
If Not ws.AutoFilter.Filters(1).On Then
MsgBox "No Conditions"
Else
Range("A1").AutoFilter Field:=1, _
Criteria1:=ws.AutoFilter.Filters(1).Criteria1
End If
End If
WC_Exit:
Application.EnableEvents = True
End Sub
'=======================
 
Debra,

What if I have different filters at different times? I really cahnge what I
am filtering on all of the time.
There are several based on time, and if the cell meets a given time, based
on current time conditions, I would like it to only show the rows I need to
be working with at a given time.
But then I have other filters established at the same time.
Filters may or may not have been set by autofilter.
Basically, the way I have been doning this, and it does not work right all
of the time is by saving the veiw , then restoring the view.

Thanks
Bruce
 
Back
Top