Loncat ke daftar isi utama

Bagaimana cara menghapus seluruh baris jika sel berisi nol di Excel?

Penulis: Matahari Terakhir Dimodifikasi: 2020-05-21

Terkadang, Anda ingin menghapus seluruh baris jika sel berisi nol di Excel, dan Anda dapat menghapusnya satu per satu jika jumlahnya sedikit. Tetapi bagaimana jika ratusan baris yang mengandung nol perlu dihilangkan? Anda bisa memilih salah satu cara rumit di bawah ini untuk menyelesaikannya.

Hapus baris jika sel berisi nol dengan fungsi Filter di Excel
Hapus baris jika sel berisi nol dengan VBA di Excel
Hapus baris jika sel berisi nol dengan Kutools for Excel


Hapus baris jika sel berisi nol dengan fungsi Filter di Excel

Anda dapat menggunakan fungsi Filter untuk memfilter semua baris berdasarkan nilai nol di kolom tertentu, lalu menghapus semua baris yang terlihat nanti. Silakan lakukan sebagai berikut.

1. Pilih sel kolom yang berisi nilai nol yang Anda ingin hapus dari seluruh baris, lalu klik Data > Filter. Lihat tangkapan layar:

2. Kemudian panah drop-down ditampilkan di sel pertama dari kolom yang dipilih, klik panah tersebut, lalu pilih Filter Angka > sama dari daftar drop-down

doc hapus jika nol 1

3. Dalam Filter Otomatis Kustom kotak dialog, masukkan nomor 0 ke dalam kotak teks seperti gambar di bawah ini yang ditampilkan, dan kemudian klik OK .

doc hapus jika nol 1

4. Kemudian semua sel nilai nol di kolom tertentu ini disaring. Pilih semua sel yang terlihat dalam kisaran filter dan klik kanan padanya, pilih Hapus Baris dari menu klik kanan. Dan di kotak prompt yang muncul, klik OK tombol. Lihat tangkapan layar:

doc hapus jika nol 1

5. Sekarang semua baris yang terlihat dihapus. Anda bisa mengklik Data > Filter lagi untuk menampilkan semua data tanpa sel nilai nol. Lihat tangkapan layar:

doc hapus jika nol 1


Hapus semua baris dengan mudah jika ada nilai nol dalam kisaran tertentu di Excel:

Kutools untuk Excel Pilih Sel Spesifik utilitas membantu Anda dengan mudah memilih seluruh baris jika ada nilai nol dalam kisaran tertentu, dan kemudian Anda dapat dengan cepat menghapus semua baris yang dipilih secara manual tanpa kesalahan.
Unduh dan coba sekarang! (Jejak gratis 30 hari)


Hapus baris jika sel berisi nol dengan VBA di Excel

Bagian ini akan menunjukkan kepada Anda metode VBA untuk menghapus semua baris jika ada nilai nol di kolom tertentu di Excel.

1. tekan Alt + F11 tombol secara bersamaan untuk menampilkan Microsoft Visual Basic untuk Aplikasi jendela.

2. Di jendela Microsoft Visual Basic for Applications, klik Menyisipkan > Modul, lalu salin dan tempel kode VBA berikut ke jendela modul.

VBA: Hapus seluruh baris jika ada nilai nol dalam rentang kolom tertentu di lembar kerja

Sub DeleteZeroRow () 'Updateby20140616 Dim Rng Sebagai Rentang Redup WorkRng Sebagai Rentang Pada Kesalahan Lanjutkan Berikutnya xTitleId = "KutoolsforExcel" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox ("Range", xTitleId, WorkRng.Address, Jenis: = 8 ) Application.ScreenUpdating = Salah Setel Rng = WorkRng.Find ("0", LookIn: = xlValues) Jika Tidak Rng Tidak Ada Lalu Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True End Sub

3. tekan F5 kunci untuk menjalankan kode, di popping KutoolsforExcel kotak dialog, pilih rentang kolom yang ingin Anda hapus seluruh baris berdasarkan nilai nol di dalamnya, lalu klik OK tombol. Lihat tangkapan layar:

doc hapus jika nol 1

Kemudian semua baris berdasarkan nilai nol dalam rentang kolom yang ditentukan segera dihapus.

doc hapus jika nol 1


Hapus baris jika sel berisi nol dengan Kutools for Excel

Bagi banyak pengguna Excel, menggunakan kode VBA berbahaya untuk menghapus data di Excel. Jika Anda tidak benar-benar mempercayai kode VBA, di sini kami menyarankan Anda untuk mencoba Pilih Sel Spesifik kegunaan Kutools untuk Excel.

Sebelum melamar Kutools untuk Excel, Mohon unduh dan instal terlebih dahulu.

1. Pilih rentang kolom yang akan Anda hapus seluruh baris berdasarkan nilai nol di dalamnya, lalu klik Kutools > Pilih > Pilih Sel Spesifik. Lihat tangkapan layar:

2. Dalam Pilih Sel Spesifik dialog, Anda perlu:

(1) Pilih Seluruh baris pilihan dalam Tipe pilihan bagian.

(2) Pilih sama di pertama Tipe khusus daftar drop-down, lalu masukkan nomor 0 ke dalam kotak teks.

(3) Klik OK .

3. Sebuah kotak dialog muncul untuk memberitahu Anda berapa banyak baris yang telah dipilih, klik OK tombol. Sekarang semua baris dengan nilai nol yang ada di kisaran kolom yang ditentukan dipilih. Harap klik kanan ke baris mana pun yang dipilih, lalu klik Delete di menu klik kanan. Lihat tangkapan layar:

doc hapus jika nol 1

Sekarang semua baris dengan nilai nol yang ada di kolom yang ditentukan segera dihapus. Lihat tangkapan layar:

doc hapus jika nol 1

  Jika Anda ingin memiliki uji coba gratis (30 hari) dari utilitas ini, silahkan klik untuk mendownloadnya, lalu lanjutkan untuk menerapkan operasi sesuai langkah di atas.


Hapus baris jika sel berisi nol dengan Kutools for Excel


Artikel Relatif:

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 (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Despues de utilizar subtotal Como hacer para eliminar las filas involucradas que en el subtotal es igual a 0?
This comment was minimized by the moderator on the site
Insert this in VB new module.
This is with InputBox to delete row which contains that word.

Attribute VB_Name = "FindDelRowByWord"
Sub FindDelRow()
'Updateby20140616
Dim Rng As Range
Dim WorkRng As Range
Dim xRep As String
On Error Resume Next
xTitleId = "ZOK Tools"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
xRep = Application.InputBox("word to delete Row:", "ZOK Tools", , , , , 2)
Application.ScreenUpdating = False
Do
Set Rng = WorkRng.Find(xRep, LookIn:=xlValues)
If Not Rng Is Nothing Then
Rng.EntireRow.Delete
End If
Loop While Not Rng Is Nothing
Application.ScreenUpdating = True
End Sub
This comment was minimized by the moderator on the site
WHAT IF you have a big sheet, and there are rows you want to keep, and others rows that contain certain key words and delete those? the kutools work for me but for one key word that many rows have that key word, the rows were deleted, i just want to have multiple key words to do the same? does this work for the code above?
This comment was minimized by the moderator on the site
Good Day,
Kutools can deal with two key words at the same time. You need to enable its second condition with "And" or "Or". Hope I can help.
This comment was minimized by the moderator on the site
This didn't work for me. It changed all values in my chosen column and the adjacent column to zeros. I must be doing something wrong!
This comment was minimized by the moderator on the site
Hi Sheri,
The code works well in my case. Which Excel verson do you use?
This comment was minimized by the moderator on the site
Hi Crystal. I posted this two years ago so I鈥檓 guessing I figured it out. But thanks for the reply.
This comment was minimized by the moderator on the site
Hi dears , I need a code to hide the rows which have the value=0 on the column "N" in the sheet 1. The value of the column "N" will change when update the details on the Sheet 2. that's the time need to un-hide the row. is this possible to do this with Excel formula(without macro and Excel Filters).
This comment was minimized by the moderator on the site
modified for my purpose--thank you for your help: Sub DeleteZeroRow() Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "" Application.Calculation = xlManual MsgBox "Set the range you want to remove the unused 0 quantity rows from" Set WorkRng = Application.InputBox("Range", xTitleId, "FG93:FG500", Type:=8) Application.ScreenUpdating = False Sheets("ENTRY").Select Do Set Rng = WorkRng.Find("0", LookIn:=xlValues) If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True Range("FF92").Select Selection.End(xlDown).Select MsgBox "Removed 0's ROWS from column FG--calculating now--please wait" Application.Calculation = xlAutomatic End Sub
This comment was minimized by the moderator on the site
I modified the below code to work for me. This deleted every row in column C that had "Delete" in the cell of column C. Sub Delete_DeleteRows() Set WorkRng = Range("C2:C12000") Application.ScreenUpdating = False Do Set Rng = WorkRng.Find("Delete", LookIn:=xlValues) If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True End Sub
This comment was minimized by the moderator on the site
Hi,
its worked for me, thanks a lot.
if I have multiple sheets? how i can run the script 1 time for all the sheets?
This comment was minimized by the moderator on the site
thanks for the response, worked for me
This comment was minimized by the moderator on the site
I modified the above code to work for me. I wanted to delete every row that had "Delete" in row C. Sub Delete_DeleteRows() Set WorkRng = Range("C2:C12000") Application.ScreenUpdating = False Do Set Rng = WorkRng.Find("Delete", LookIn:=xlValues) If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True End Sub
This comment was minimized by the moderator on the site
Your VB code doesn't work. It deletes all rows with a Zero in the 10s position. I hope no one actually uses this as they will delete data...
This comment was minimized by the moderator on the site
This was a life saver!!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations