Excel Userform update data – Gratis file download

Last updated on September 30th, 2021 at 09:21 pm

CONTOH KASUS:
Majikan Susi mengalami kesulitan ketika dia perlu untuk mengkoreksi, menghapus ataupun menambah data pada halaman Excel. Oleh karena itu dia menyuruh Susi untuk mencari cara agar dia merasa lebih mudah ketika dia meng-update data di halaman Excel. Susi memutuskan untuk membuat sebuah Excel Userform untuk meng-update data agar majikannya tidak lagi mengalami kesulitan dalam meng-update data. Disamping itu, Susi sendiri pun juga merasa lebih nyaman menggunakan Excel user form dalam mengkoreksi, menghapus ataupun menambah data dengan Excel Userform ketika majikannya menyuruh dia untuk meng-update data.

Akhirnya jadilah user form yang Susi buat. Adapun kontrol kontrol yang Susi gunakan pada user form-nya adalah sbb :

  • 1 buah multi kolom list box, terdiri dari 6 kolom sebagai header data.
  • 1 buah multi kolom list box, terdiri dari 6 kolom sebagai tempat untuk menampilkan data yang ada pada halaman Excel.
  • 1 buah text box, digunakan sebagai kotak pencarian data NAMA.
  • 6 buah text box, sesuai dengan jumlah kolom data yang akan digunakan untuk mengkoreksi data.
  • 1 buah tombol, digunakan untuk membersihkan ke 6 text box tsb sebelum menambah data
  • 1 buah tombol, digunakan untuk menghapus baris data

Pada gambar animasih dibawah ini adalah memilih data pada list box. Ketika salah satu baris data pada list box di klik, maka data terkait pada halaman Excel ikut juga terpilih.

Memilih data melalui Excel user form

Untuk mencari data NAMA, nama yang dicari diketik pada kotak pencarian. List box akan menampilkan data sesuai dengan apa yang diketikkan pada kotak pencarian. Seperti yang terlihat pada animasi dibawah ini.

Menyaring data pada kotak pencarian

Untuk mengkoreksi data, maka baris yang ingin di koreksi di klik terlebih dahulu pada list box. Setelah itu koreksi data di lakukan di manapun text box yang terdapat di bawah user form, tergantung kolom mana yang ingin di koreksi. Seperti yang terlihat pada animasi dibawah ini.

Mengkoreksi data pada Excel Userform

Selanjutnya, untuk menambah data, maka ke enam kotak text box harus bersih terlebih dahulu apabila sebelumnya terdapat data. Dengan menggunakan tombol CLEAR BEFORE ADD, maka ke enam kotak text box menjadi bersih, demikian pula tidak ada baris yang terpilih pada list box. Barulah dilakukan penambahan data dengan mengetik pada ke enam text box yang tersedia. Seperti yang terlihat pada gambar animasi dibawah ini.

Menambah data baru melalui Excel user form

Dan yang terakhir adalah menghapus data. Untuk menghapus data, maka salah satu baris pada list box harus di klik terlebih dahulu, sesuai dengan data di baris mana yang ingin di hapus. Barulah setelah itu tombol DELETE SELECTED ITEM di klik untuk menghapus baris yang dipilih tsb. Seperti animasi dibawah ini.

Menghapus data melalui Excel user form

VARIABEL VARIABEL
Set sh = Sheets("DATA")
“DATA” adalah nama halaman/tab dimana data berada. Ganti text “DATA” dengan nama halaman yang terdapat data kamu apabila ingin sesuai dengan halaman sendiri.

Set s = sh.Range("B1")
“B1” adalah kolom dan baris header tabel yang paling kiri. Dalam contoh pada gambar gambar diatas, cell header yang paling kiri adalah cell B1. Ganti text “B1” dengan cell yang sesuai dengan header data kamu apabila ingin sesuai dengan data sendiri.

dtCol = 4
Angka 4 adalah kolom ke-lima data tabel yang berupa kolom TANGGAL (seperti yang terlihat pada contoh gambar gambar diatas). Semisal kolom header TANGGAL kamu berada di kolom pertama pada data tabel, maka ganti nilai dtCol menjadi dtCol = 0 Semisal data kamu tidak ada tanggal, maka isi nilai dtCol = -1.

numCol = 5
Angka 5 adalah kolom ke-enam data tabel yang berupa kolom HARGA (seperti yang terlihat pada contoh gambar gambar diatas). Semisal kolom header HARGA (ataupun kolom header yang isinya berupa numerik) kamu berada di kolom ketiga pada data tabel kamu, maka ganti nilai numCol menjadi numCol = 2. Semisal data kamu tidak ada kolom yang barisnya berisi angka angka yang ingin di format rupiah-ribuan, maka isi nilai numCol = -1 .

Jadi untuk variabel dtCol dan numCol, nilainya itu selalu minus 1 dari kolom tabel. Kolom tabel ya, bukan kolom halaman secara keseluruhan.

Semisal data tabel kamu ada 5 kolom (pada contoh gambar gambar diatas, data tabel terdiri dari 6 kolom), maka hapus text box yang bernama tb6. Semisal data tabel kamu ada 7 kolom, maka tambahkan satu buah text box lagi dan nama-kan tb7. Setiap text box yang diperuntukan untuk mengkoreksi/mengubah ataupun menambah data, nama-nya harus selalu dimulai dgn tb lalu di ikuti dengan angka sesuai dengan kolom tabel terkait.

Kotak pencarian ngerujuknya ke kolom pertama data tabel. Pada ilustrasi animasi animasi diatas, dalam hal ini kolom pertama data tabel adalah kolom NAMA. Apabila kamu ingin rubah pencariannya ke kolom lain namun tidak tau cara rubah kodenya, silahkan tanyakan di kolom pesan.

Userform ini menggunakan “kolom pembantu”, yakni kolom pas setelah kolom terakhir data tabel (pada gambar animasi animasi diatas, dalam hal ini kolom H). Jadi pastikan kolom disamping kolom terakhir data tabel kamu tidak berisi apapun, alias kosong. Semisal data tabel kamu dimulai pada cell A4 dan berakhir di cell D4 (tabel dengan 4 kolom), maka pastikan bahwa kolom E tidak terpakai, kosong.

Untuk kontrol list box header, list box data dan setiap kontrol text box “tb”, lebarnya akan diatur oleh kode. Jadi di VBA editor, ukuran lebar kontrol kontrol tersebut bisa diabaikan.

Demikian sekilas Excel Userform untuk update data yang terdapat pada halaman Excel. Jangan lupa untuk mengganti variable variable-nya terlebih dahulu apabila mau coba di aplikasikan dengan data sendiri. Terimakasih.

214 replies on “Excel Userform update data – Gratis file download”

Hello There. I found your blog the usage of msn. This is an extremely smartly written article.I’ll be sure to bookmark it and come back to learn more ofyour helpful information. Thanks for the post.I’ll definitely return.

Howdy! This post could not be written much better!Going through this article reminds me of my previous roommate!He constantly kept talking about this. I am going to send thisarticle to him. Pretty sure he will have a great read.Thanks for sharing!

Wow that was odd. I just wrote an really long comment butafter I clicked submit my comment didn’t show up. Grrrr…well I’m not writing all that over again. Regardless, just wantedto say wonderful blog!

When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment. Is there any way you can remove me from that service? Cheers!

Excellent beat ! I would like to apprentice while you amend your site, how could i subscribe for a blog web site? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright clear idea

I enjoy you because of all your valuable work on this blog. My mother delights in conducting internet research and it’s easy to see why. Almost all notice all concerning the compelling ways you give very helpful tricks on the website and even foster contribution from other individuals about this area of interest plus our simple princess has always been starting to learn a whole lot. Have fun with the rest of the new year. You have been carrying out a stunning job.

Hey! This is my first visit to your blog! We are a collection of volunteers and starting a new initiative in a community in the same niche. Your blog provided us valuable information to work on. You have done a extraordinary job!

This design is spectacular! You obviously know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job. I really loved what you had to say, and more than that, how you presented it. Too cool!

Definitely believe that which you said. Your favorite justification seemed to be on the net the simplest thing to be aware of. I say to you, I definitely get annoyed while people consider worries that they plainly do not know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side effect , people can take a signal. Will probably be back to get more. Thanks

Oh my goodness! Awesome article dude! Thank you, However I am having problems with your RSS. I don’t know why I can’t subscribe to it. Is there anybody else getting identical RSS issues? Anyone that knows the solution will you kindly respond? Thanx.

Excellent post. I was checking continuously this blog and I am impressed! Very helpful information specially the last part 🙂 I care for such information much. I was looking for this particular info for a very long time. Thank you and best of luck.

Do you have a spam issue on this blog; I also am a blogger, and Iwas wanting to know your situation; many of us have developedsome nice practices and we are looking to trade solutions withother folks, be sure to shoot me an e-mail if interested.

I’m not sure where you’re getting your info, but great topic. I needs to spend some time learning more or understanding more. Thanks for fantastic info I was looking for this information for my mission.

I was suggested this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are wonderful! Thanks!

excellent submit, very informative. I ponder why the other experts of this sector do not realize this. You must continue your writing. I’m confident, you have a great readers’ base already!

Hi there! I know this is somewhat off topic but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having problems finding one? Thanks a lot!

Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

Leave a Reply

Your email address will not be published. Required fields are marked *