Jumat, 29 Agustus 2014

Excel Mine for WH - Barang Keluar

Private Sub cb_nama_barang_Change()
    Dim index As Integer
    index = cb_nama_barang.ListIndex
    tb_kode = Cells(index + 1000, 29).Value
    tb_unit = Cells(index + 1000, 30).Value
End Sub
Private Sub cmd_data_base_Click()
    ThisWorkbook.Application.Visible = True
    Worksheets("OUT").Activate
    FormOut.Hide
End Sub

Private Sub cmd_tambah_data_Click()

    Dim Wury As Long
    Worksheets("OUT").Activate
    Wury = WorksheetFunction.CountA(Range("A:A")) + 3
    Cells(Wury, 1).Value = tb_kode.Value
    Cells(Wury, 2).Value = cb_nama_barang.Value
    Cells(Wury, 3).Value = tb_unit.Value
    Cells(Wury, 4).Value = tb_tgl_terima.Value
    Cells(Wury, 5).Value = tb_jumlah.Value
    Cells(Wury, 9).Value = tb_ket
'=============================================================================

Sorce Code VBA Excel

Credit untuk :belajar-vbe.blogspot.com/

Bermaksud untuk mengingat saja bukan untuk copy paste... mohon maaf credit di atas ya... sekalian belajar.

Beberapa Contoh Kode


AUTO RUN

Ada beberapa cara untuk membuat macros yang kita buat berjalan secara otomatis ketika pertama kali membukaworkbook. Yang pertama adalah Auto Open Method, yang diletakkan di modules, kedua adalah Workbook Open Method, yang diletakkan di pada obyek Workbook (lihat penjelasan pada langkah 3). Dua Contoh kode berikut akan menampilkan pesan “hi” ketika Workbook pertama kali dibuka.
Sub Auto_Open( )
Msgbox “hi”
End Sub
Private Sub Workbook_Open( )
Msgbox “hi”
End Sub