Loncat ke daftar isi utama

 Bagaimana cara memperbarui hasil filter lanjutan secara otomatis di Excel?

Ketika kita menerapkan fitur Filter Lanjutan, kita akan menemukan bahwa hasil yang difilter tidak akan berubah secara otomatis dengan perubahan kriteria. Ini membutuhkan kita untuk menerapkan fungsi Filter Lanjutan sekali lagi untuk mendapatkan hasil yang baru. Tapi, apakah Anda memiliki trik yang bagus dan cepat untuk memperbarui hasil filter lanjutan secara otomatis seperti tangkapan layar berikut yang ditampilkan di Excel?

Perbarui hasil filter lanjutan secara otomatis dengan kode VBA


Perbarui hasil filter lanjutan secara otomatis dengan kode VBA

Kode VBA berikut dapat membantu Anda untuk secara otomatis memperbarui hasil filter lanjutan saat Anda mengubah kriteria yang Anda butuhkan, lakukan seperti ini:

1. Klik kanan tab lembar yang ingin Anda filter data secara otomatis, lalu pilih Lihat kode dari menu konteks, di buka Microsoft Visual Basic untuk aplikasi jendela, salin dan tempel kode berikut ke dalam Modul kosong:

Kode VBA: Perbarui hasil filter lanjutan secara otomatis:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A5:D21").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range _
("A1:C3"), Unique:=False
End Sub

Note: Pada kode diatas: A5: D21 adalah rentang data yang ingin Anda filter, A1: C3 adalah rentang kriteria yang akan difilter.

2. Kemudian simpan dan tutup jendela kode, sekarang, ketika Anda mengubah kriteria dalam rentang kriteria, hasil yang difilter akan diperbarui secara otomatis sekaligus.

Alat Produktivitas Kantor Terbaik

馃 Kutools AI Ajudan: Merevolusi analisis data berdasarkan: Eksekusi Cerdas   |  Hasilkan Kode  |  Buat Rumus Khusus  |  Analisis Data dan Hasilkan Grafik  |  Aktifkan Fungsi Kutools...
Fitur Populer: Temukan, Sorot, atau Identifikasi Duplikat   |  Hapus Baris Kosong   |  Gabungkan Kolom atau Sel tanpa Kehilangan Data   |   Putaran tanpa Formula ...
Pencarian Super: VLookup Beberapa Kriteria    VLookup Nilai Berganda  |   VLookup di Beberapa Lembar   |   Pencarian Fuzzy ....
Daftar Drop-down Lanjutan: Buat Daftar Drop Down dengan Cepat   |  Daftar Drop Down yang Bergantung   |  Multi-pilih Drop Down List ....
Manajer Kolom: Tambahkan Jumlah Kolom Tertentu  |  Pindahkan Kolom  |  Alihkan Status Visibilitas Kolom Tersembunyi  |  Bandingkan Rentang & Kolom ...
Fitur Unggulan: Fokus Kisi   |  Tampilan Desain   |   Bar Formula Besar    Manajer Buku Kerja & Lembar   |  Perpustakaan Sumberdaya (Teks otomatis)   |  Pemetik tanggal   |  Gabungkan Lembar Kerja   |  Enkripsi/Dekripsi Sel    Kirim Email berdasarkan Daftar   |  Filter Super   |   Filter Khusus (filter tebal/miring/coret...) ...
15 Perangkat Teratas12 Teks Tools (Tambahkan Teks, Hapus Karakter, ...)   |   50 + Grafik jenis (Gantt Chart, ...)   |   40+ Praktis Rumus (Hitung usia berdasarkan ulang tahun, ...)   |   19 Insersi Tools (Masukkan Kode QR, Sisipkan Gambar dari Jalur, ...)   |   12 Konversi Tools (Angka ke Kata, Konversi Mata Uang, ...)   |   7 Gabungkan & Pisahkan Tools (Lanjutan Gabungkan Baris, Pisahkan Sel, ...)   |   ... dan banyak lagi

Tingkatkan Keterampilan Excel Anda dengan Kutools for Excel, dan Rasakan Efisiensi yang Belum Pernah Ada Sebelumnya. Kutools for Excel Menawarkan Lebih dari 300 Fitur Lanjutan untuk Meningkatkan Produktivitas dan Menghemat Waktu.  Klik Di Sini untuk Mendapatkan Fitur yang Paling Anda Butuhkan...

Deskripsi Produk


Tab Office Membawa antarmuka Tab ke Office, dan Membuat Pekerjaan Anda Jauh Lebih Mudah

  • Aktifkan pengeditan dan pembacaan tab di Word, Excel, PowerPoint, Publisher, Access, Visio, dan Project.
  • Buka dan buat banyak dokumen di tab baru di jendela yang sama, bukan di jendela baru.
  • Meningkatkan produktivitas Anda sebesar 50%, dan mengurangi ratusan klik mouse untuk Anda setiap hari!
Comments (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
This is likely not relevant anymore. Office excel now has a FILTER function that auto updates from what I gather, making advanced filter a sort of weak pivot table. FILTER function is what should be used moving forward? Sounds like excel's solution to the issue you state above not requring VBA to do.
This comment was minimized by the moderator on the site
Hi, I am applying advanced filter for a single column for unique values(with no criteria) . I need it to be updated by itself.

Could you please help me with that?
This comment was minimized by the moderator on the site
Is there a way to do this without using VBA?
This comment was minimized by the moderator on the site
Hello, this code works perfectly, there is just one problem, the copy/paste fonction doesn't work anymore.
How could it be fixed?
Thanks in advance
This comment was minimized by the moderator on the site
@Hannah: Yes, it is possible.
In the following code the criteria is on the sheet "Filter".


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A5:D23").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Sheets("Filter").Range("A1:C3"), Unique:=False
End Sub
This comment was minimized by the moderator on the site
Ce code donne une erreur 1004 r茅f茅rence non valide. pouvez vous corriger le code propos茅?
This comment was minimized by the moderator on the site
Bonjour, merci pour votre post qui m'aide 茅norm茅ment. Toutefois quel serait le code 脿 ajouter pour coller le r茅sultat dans un tableau d'une autre feuille de fichier et si possible pour au passage ne coller que certaines colonnes ?
Pour 锚tre plus pr茅cise, en utilisant votre exemple je voudrais copier uniquement les colonnes "Product" et "Name" du r茅sultat du filtre et ce dans une nouvelle feuille. Merci.
This comment was minimized by the moderator on the site
Can I make the criteria come from a second sheet?
This comment was minimized by the moderator on the site
it refreshes every time when any data changes.

is it possible to refresh only when criteria changes.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations