Membuat Form Input

Ada masalah dengan input data? Berikut tutorial untuk membuat form input data menggunakan macro VBA yang ada di Excel


1. Buka Excel 2007.
2. Simpan Book1 dengan nama sesuai keinginan anda menggunakan type Excel Macro - Enabled Workbook
3, Buat tabel seperti dengan contoh yang di

4. Tekan Ctrl + S
5. Kemudian tekan Alt + F11 untuk masuk ke VBA Excel
6. Setelah jendela VBA muncul klik menu Insert - UserForm
7. Atur Label, Textbox, Combo Box dan Command Button, dengan setting properti sebagai berikut:


ObjekProperti
UserformName= frm_input, Caption= FORM INPUT, BackColor= "&H8000000A&", Width= 538, Height= 504
Label1Name= Label1, Caption= NOMOR, Height= 18, Width= 72
Label2Name= Label2, Caption= NAMA, Height= 18, Width= 72
Label3Name= Label3, Caption= JENIS KELAMIN, Height= 18, Width= 72
Label4Name= Label4, Caption= TEMPAT, Height= 18, Width= 72
Label5Name= Label5, Caption= TANGGAL, Height= 18, Width= 72
Label6Name= Label6, Caption= BULAN, Height= 18, Width= 72
Label7Name= Label7, Caption= LAHIR, Height= 18, Width= 72
Label8Name= Label8, Caption= TAHUN, Height= 18, Width= 72
Label9Name= Label9, Caption= JL./DUSUN, Height= 18, Width= 72
Label10Name= Label10, Caption= ALAMAT, Height= 18, Width= 72
Label11Name= Label11, Caption= RT/RW, Height= 18, Width= 72
Label12Name= Label12, Caption= DESA, Height= 18, Width= 72
Label13Name= Label13, Caption= KECAMATAN, Height= 18, Width= 72
Label14Name= Label14, Caption= KABUPATEN, Height= 18, Width= 72
Label15Name= Label15, Caption= PROPINSI, Height= 18, Width= 72
Label16Name= Label16, Caption= NO. HP, Height= 18, Width= 72
TextboxName= txtNIS, Font= Tahoma, Font size= 12, Height= 24
TextboxName= txtNAMA, Font= Tahoma, Font size= 12, Height= 24
TextboxName= txttemlahi, Font= Tahoma, Font size= 12, Height= 24
TextboxName= txtTgl, Font= Tahoma, Font size= 12, Height= 24, Width= 42
TextboxName= txtTahlah, Font= Tahoma, Font size= 12, Height= 24, Width= 96
TextboxName= txtdus, Font= Tahoma, Font size= 12, Height= 24
TextboxName= txtRT, Font= Tahoma, Font size= 12, Height= 24
TextboxName= txtDES, Font= Tahoma, Font size= 12, Height= 24
TextboxName= txtCAM, Font= Tahoma, Font size= 12, Height= 24
TextboxName= txtBUP, Font= Tahoma, Font size= 12, Height= 24
TextboxName= txtProp, Font= Tahoma, Font size= 12, Height= 24
TextboxName= txtHP, Font= Tahoma, Font size= 12, Height= 24
ComboBoxName= cboJEKA, Font= Tahoma, Font size= 12, Height= 24, Width= 126
ComboBoxName= cboBULAN, Font= Tahoma, Font size= 12, Height= 24, Width= 126
CommandButtonName= cmdInput, Caption= INPUT, Height= 30, Width= 108
CommandButtonName= cmdBATAL, Caption= BATAL, Height= 30, Width= 108

8. Sehingga jadi seperti gambar berikut


9. Ketikkan kode program berikut pada Object Module dengan klik 2 kali pada userform yang sudah dibuat

10. Klik menu Insert - Module untuk menambahkan modul baru

11. Pada jendela Project muncul folder baru dengan nama Modules - Module1. Pilih Module1 dan klik 2 kali untuk memasukkan kode berikut

Sub tampilkanform()
frm_input.Show
End Sub
12. Tekan Ctrl+S untuk menyimpan pekerjaan anda.
13. Tutup VBA Excel dengan klik tombol Close (X) pada sudut kanan atas jendela VBA.
14. Coba jalankan macro dengan menekan tombol Alt + F8 pilih macro tampilkanform, akan muncul form input yang sudah dibuat.
15. Masukkan data pada semua kolom dan tekan INPUT. Jika semua berjalan mulus data yang diketikkan pada form Input akan masuk pada tabel yang sudah dibuat.


selamat mencoba..............

download Contoh file
Form INPUT

lihat cara downloadnya di sini

Twitter Delicious Facebook Digg Stumbleupon Favorites More