Բաց թողնել հիմնական բովանդակությունը

Ինչպե՞ս ինքնաբերաբար նորից կիրառել ավտոմատ զտիչը, երբ Excel- ում տվյալների փոփոխություն է կատարվում:

Excel- ում, երբ դուք կիրառում եք ֆիլտր գործառույթը ՝ տվյալների զտման համար, զտիչի արդյունքը չի փոխվի ինքնաբերաբար ՝ ձեր զտված տվյալների տվյալների փոփոխություններով: Օրինակ, երբ ես բոլոր Խնձորները զտում եմ տվյալներից, այժմ ես զտված տվյալներից մեկը փոխում եմ BBBBBB, բայց արդյունքը չի փոխվի, ինչպես նաև ցույց տրված սքրինշոթը: Այս հոդվածում ես կխոսեմ այն ​​մասին, թե ինչպես վերափոխել ավտոմատ զտիչը ավտոմատ կերպով, երբ Excel- ում տվյալների փոփոխություն է կատարվում:

doc auot թարմացնել զտիչը 1

Ավտոմատ կերպով կիրառեք ավտոմատ զտիչը, երբ տվյալները փոխվում են VBA կոդով


նետ կապույտ աջ պղպջակ Ավտոմատ կերպով կիրառեք ավտոմատ զտիչը, երբ տվյալները փոխվում են VBA կոդով

Սովորաբար, զտիչի տվյալները կարող եք թարմացնել ՝ ձեռքով կտտացնելով «Դիմել» գործառույթը, բայց, ահա, ես ձեզ կներկայացնեմ VBA կոդ ՝ ֆիլտրի տվյալներն ավտոմատ կերպով թարմացնելու համար, երբ տվյալները փոխվում են, խնդրում եմ արեք հետևյալը.

1, Գնացեք դեպի այն աշխատանքային թերթը, որը ցանկանում եք ավտոմատ թարմացնել զտիչը, երբ տվյալները փոխվում են:

2, Աջ կտտացրեք թերթիկի ներդիրին և ընտրեք Դիտել կոդը համատեքստի ընտրացանկից ՝ դուրս եկած պատուհանում Microsoft Visual Basic հավելվածների համար պատուհանը, խնդրում ենք պատճենել և տեղադրեք հետևյալ կոդը դատարկ Մոդուլի պատուհանում, տեսեք,

VBA կոդ. Տվյալների փոփոխության ժամանակ ավտոմատ կերպով կիրառեք զտիչը.

Private Sub Worksheet_Change(ByVal Target As Range)
   Sheets("Sheet3").AutoFilter.ApplyFilter
End Sub

doc auot թարմացնել զտիչը 2

ՆշումՎերը նշված կոդում Թերթիկը 3 ձեր կողմից օգտագործվող ավտոֆիլտրով թերթիկի անվանումն է, խնդրում ենք փոխել այն ըստ ձեր պահանջի

3, Եվ ապա պահեք և փակեք այս կոդի պատուհանը, այժմ, երբ փոխեք զտված տվյալները, ֆիլտր գործառույթը միանգամից ավտոմատ կթարմացվի, տես նկարի նկարը.

doc auot թարմացնել զտիչը 3

Գրասենյակի արտադրողականության լավագույն գործիքները

🤖 Kutools AI օգնականՀեղափոխություն կատարել տվյալների վերլուծության հիման վրա՝ Խելացի կատարում   |  Ստեղծեք ծածկագիր  |  Ստեղծեք հատուկ բանաձևեր  |  Վերլուծել տվյալները և ստեղծել գծապատկերներ  |  Invoke Kutools-ի գործառույթները...
Հանրաճանաչ հատկություններ: Գտեք, ընդգծեք կամ նույնականացրեք կրկնօրինակները   |  Deleteնջել դատարկ շարքերը   |  Միավորել սյունակները կամ բջիջները՝ առանց տվյալների կորստի   |   Կլոր առանց բանաձևի ...
Super Փնտրել: Բազմաթիվ չափանիշների VLookup    Բազմակի արժեք VLookup  |   VLookup բազմաթիվ թերթերում   |   Fuzzy Փնտրել ....
Ընդլայնված բացվող ցուցակ: Արագ ստեղծեք բացվող ցուցակը   |  Կախված բացվող ցուցակ   |  Բազմակի ընտրություն Drop Down ցուցակ ....
Սյունակի կառավարիչ: Ավելացրեք որոշակի քանակությամբ սյունակներ  |  Տեղափոխել սյունակները  |  Փոխարկել թաքնված սյունակների տեսանելիության կարգավիճակը  |  Համեմատեք միջակայքերը և սյունակները ...
Առանձնահատկություններ: Ցանցի կենտրոնացում   |  Դիզայնի տեսք   |   Մեծ Formula Bar    Աշխատանքային գրքույկի և թերթիկների կառավարիչ   |  Ռեսուրսների գրադարան (Ավտոմատ տեքստ)   |  Ամսաթիվ ընտրող   |  Միավորել աշխատանքային թերթերը   |  Գաղտնագրել/գաղտնազերծել բջիջները    Ուղարկեք նամակներ ըստ ցանկի   |  Սուպեր զտիչ   |   Հատուկ զտիչ (զտել թավ/շեղ/շեղված...) ...
Լավագույն 15 գործիքների հավաքածու12 Տեքստ Գործիքներ (Ավելացրեք տեքստ, Հեռացնել նիշերը, ...)   |   50+ Աղյուսակ Տեսակներ (Գանտի աղյուսակը, ...)   |   40+ Գործնական Բանաձեւեր (Հաշվարկել տարիքը ՝ ելնելով ծննդյան տարեդարձից, ...)   |   19 միացում Գործիքներ (Տեղադրեք QR կոդ, Տեղադրեք նկար ուղուց, ...)   |   12 Փոխարկում Գործիքներ (Բառեր համարներ, Արտարժույթի փոխակերպումը, ...)   |   7 Միաձուլում և պառակտում Գործիքներ (Ընդլայնված կոմբինատ տողեր, Պառակտված բջիջներ, ...)   |   ... եւ ավելին

Լրացրեք ձեր Excel-ի հմտությունները Kutools-ի հետ Excel-ի համար և փորձեք արդյունավետությունը, ինչպես երբեք: Kutools-ը Excel-ի համար առաջարկում է ավելի քան 300 առաջադեմ առանձնահատկություններ՝ արտադրողականությունը բարձրացնելու և ժամանակ խնայելու համար:  Սեղմեք այստեղ՝ Ձեզ ամենաշատ անհրաժեշտ հատկանիշը ստանալու համար...

Նկարագրություն


Office Tab- ը Tabbed ինտերֆեյսը բերում է Office, և ձեր աշխատանքը շատ ավելի դյուրին դարձրեք

  • Միացնել ներդիրներով խմբագրումը և ընթերցումը Word, Excel, PowerPoint- ով, Հրատարակիչ, Access, Visio և Project:
  • Բացեք և ստեղծեք բազմաթիվ փաստաթղթեր նույն պատուհանի նոր ներդիրներում, այլ ոչ թե նոր պատուհաններում:
  • Բարձրացնում է ձեր արտադրողականությունը 50%-ով և նվազեցնում մկնիկի հարյուրավոր սեղմումները ձեզ համար ամեն օր:
Comments (39)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Finally got the filter to update automatically. My scenario included a filter on sheet "Master" that had a formulas that depended on other sheets (named 1, 2,...,21).

Paste this in the source code into the "Master" sheet.

Private Sub Worksheet_Calculate()
On Error Resume Next
Application.EnableEvents = False
Me.AutoFilter.ApplyFilter
Application.EnableEvents = True
End Sub


Paste this in the source code of each sheet that feeds data into the master sheet. (Sheet 21 shown from my scenario)

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Sheets("Master").AutoFilter.ApplyFilter
End Sub
This comment was minimized by the moderator on the site
Its not working if able changing by itslef, like when you linking data from another app, can someone help me fix this please
This comment was minimized by the moderator on the site
Pasted it as shown, but not working. The sheet I need updated is an invoice that has formulas that are pulling from another sheet. Since the blank cells all have formulas in them, is that preventing it from working? Seems simple for it to work, so I'm getting frustrated with myself.
This comment was minimized by the moderator on the site
2022 update!
Just add this to the sheets you want it applied too.

Private Sub Worksheet_Change(ByVal Target As Range)
AutoFilter.ApplyFilter
End Sub
Rated 5 out of 5
This comment was minimized by the moderator on the site
My input data is on the first sheet of the book, and the table in which the filter is applied is on another sheet of the same book. When I change the data on the first sheet, the filter on the second sheet should be updated. But if at the time of changing the data, a cell in the range of this table is not selected, then I get an error:"Run-time error '91': Object variable or With block variable not set". Therefore, i am should always check that the cursor is in a table range cell and not in any other place on the sheet. How to fix it?Solved:
Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("name of sheet").ListObjects("name of table").AutoFilter.ApplyFilter
End Sub
This comment was minimized by the moderator on the site
Thank you. Works great!
This comment was minimized by the moderator on the site
Hey this works great but I'd like to re-apply the autofilter to multiple sheets if possible.
I have 3 sheets (Enquiry, Booked, No sale)

What I'm trying to do is essentially move the data when I change the item status code:
"Enquiry" is filtered to show 'In progress' only, "Booked" is filtered to show 'Booked' only etc

Is there a way to re-apply filter to multiple worksheets when making a change on "enquiry"
This comment was minimized by the moderator on the site
I actually have data from an other Excel file that got imported in a Excelsheet with the name "Database". Then I import this data in the same Excel file but in an other ExcelSheet "Overview". I want when the data changes in the orgininal source, that the filter applies in the sheet "Overview". Thank you in forward for the one who can help me :). P.S. cant use VBA in the firt excelsheet
This comment was minimized by the moderator on the site
Hi,

This is a great bit of code thank you. The only issue I am having is I'm using a drop down on a separate chart sheet. If I manually change the value in the cell associated with the drop down, it works. But when I try to just use the drop down, it won't update. Any thoughts?
This comment was minimized by the moderator on the site
Hi, thanks so much for the help. Something isn't working right for me. Here's the story.

Sheet1 has variable data. Sheet3 has static data and filter. Filter criteria on "Sheet3" comes from Sheet1. Sheet1 has data that comes from filtered results on Sheet3.

Sheet3 has code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1:U14").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range("A22:U23"), CopyToRange:=Range("A25:U26"), Unique:=False
End Sub

It works great if I do anything on Sheet3. No problems. Thank you!

At first I had code on Sheet1:

Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("Sheet3").AutoFilter.ApplyFilter
End Sub

Which resulted in the error "Runtime error 91, Object Variable or With Block not Set".

I changed the code based on comments to be:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Sheets("Sheet3").AutoFilter.ApplyFilter
End Sub

Now I don't get an error, but the data on Sheet3 and therefore Sheet1 don't change. In other words, the event of applying the filter to Sheet3 doesn't occur when I make a change on Sheet1. It doesn't matter if I hit <return> or click on another cell after changing the Sheet3 filter criteria cell that is set on Sheet1.

As an aside, I expect that if I wanted to have multiple cells on Sheet1 that caused filters on Sheets 4 and 5 in addition to Sheet3, I would need the code on Sheet 1 to read:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Sheets("Sheet3").AutoFilter.ApplyFilter
Sheets("Sheet4").AutoFilter.ApplyFilter
Sheets("Sheet5").AutoFilter.ApplyFilter
End Sub

Thanks again!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations