Loncat ke daftar isi utama

Bagaimana cara memunculkan kotak pesan jika nilai sel berubah dalam kisaran di Excel?

Terkadang Anda perlu mengingatkan diri Anda sendiri tentang perubahan dalam rentang di lembar kerja tertentu. Jadi kotak pesan pop up akan membantu Anda jika nilai sel telah berubah dalam kisaran tertentu. Anda dapat mencapainya dengan metode VBA di artikel ini.

Kotak pesan pop up jika nilai sel berubah dalam kisaran dengan kode VBA


Kotak pesan pop up jika nilai sel berubah dalam kisaran dengan kode VBA

Kode VBA berikut akan memunculkan kotak pesan jika nilai sel berubah dalam kisaran tertentu dari lembar kerja tertentu. Silakan lakukan sebagai berikut.

1. tekan lain + F11 tombol secara bersamaan untuk membuka Microsoft Visual Basic untuk Aplikasi jendela.

2. Dalam Microsoft Visual Basic untuk Aplikasi jendela, klik dua kali nama lembar (kisaran yang ditentukan ada) di bilah kiri untuk membukanya Kode jendela, lalu salin dan tempel kode VBA di bawah ini ke dalam jendela.

Kode VBA: kotak pesan pop up jika nilai sel berubah dalam suatu rentang

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not (Application.Intersect(Range("A1:E19"), Target) Is Nothing) Then
        MsgBox "Cell " & Target.Address & " has changed.", vbInformation, "Kutools for Excel"
    End If
End Sub

Note: Anda dapat mengubah rentang yang ditentukan A1: E19 dalam kode ke kisaran yang Anda butuhkan.

3. tekan lain + Q kunci sekaligus untuk menutup Microsoft Visual Basic untuk Aplikasi jendela.

Untuk saat ini, ketika nilai sel dalam rentang A1: E19 berubah, kotak pesan akan muncul secara otomatis. Lihat tangkapan layar:

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 (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi everyone & thanks for help!!!!

How could I modify the VBA to show the excel cell informattion in MsgBox......?????
This comment was minimized by the moderator on the site
Hi everyone & thanks for help!!!!

How could I modify the VBA and say that if the Range B1:B50 is less than or equal to Range A1:B50 then MsgBox......?????
This comment was minimized by the moderator on the site
Good Day,
Do you mean the total sum of range b1:b50?
This comment was minimized by the moderator on the site
Hi everyone & thanks for the VBA.

I was just wondering how to modify the VBA in case that I want the MsgBox only if for example the cell value B1 is <= than A1


Thanks for your assistance!!!
This comment was minimized by the moderator on the site
Good Day,
Please try below VBA code:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ExitSub
Dim One As Long
Dim Two As Long
One = Range("A1").Value
Two = Range("B1").Value
If Not (Application.Intersect(Range("A1:B1"), Target) Is Nothing) Then
If (One > Two) Then
MsgBox "Range(""A1"") > Range(""B1"")", vbInformation, "Kutools for Excel"
End If
End If
ExitSub:
End Sub
This comment was minimized by the moderator on the site
Considering the above example.(VBA code: pop up message box if cell value changes within a range)

when the value of D14 has changed we get a pop up, in the similar way how to get the ID of that (column A of the same row (A14)).
Thanks in advance, any response is appreciable.
This comment was minimized by the moderator on the site
considering the above output there is a question.
we got a pop message when the D14 has changed, in the similar can way can we get the ID (data of the same row of the column A) in the pop up message??
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations