Automatically Updating Filter in Multiple Sheets

G

Guest

I have data in multiple sheets. Each row of data in each sheet is identified
with a text identifier. I can use auto-filter to select the prefered text
identifier in each sheet so that it shows only that data required. This is
slow and tedious.

I have also tried the Advanced filter referencing a Named cell which
indicates the indentifier. However, I still have to update each sheet
manually. Is there a way to automatically update the single filter on all
sheets simply by typing in the text identifier in a Named cell and pressing
enter?

Thanks in Advance,

TonyG
 
D

Dave Peterson

How about something like this:

Option Explicit
Sub testme()

Dim myValue As Variant
Dim wks As Worksheet

myValue = Worksheets("Sheet1").Range("a1").Value

For Each wks In ActiveWorkbook.Worksheets
With wks
If .FilterMode Then
.ShowAllData
End If
With .AutoFilter.Range
.AutoFilter field:=1, Criteria1:=myValue
End With
End With
Next wks
End Sub

I used A1 of Sheet1 for my key value.

And I filtered on the first column in the autofilter range.

(I'd put a button from the Forms toolbar near that key cell and assign it to
this macro.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top