Senin, 28 September 2015

Kode VBA

  contoh kode vba

Beberapa kode VBA di Ms. Excel memang tidak ada habisnya tergantung kreativitas kita sebagai pengguna atau pecinta VBA for Excel. Seperti yang sudah dijelaskan untuk belajar kode VBA dasar silakan di
Kumpulan Kode VBA Dasar

dan Berikut Kode VBA untuk latihan Anda silakan dicoba

Sub VBAExcelidDOTcom()
    Dim Terbesar As Integer
    Dim baris As Integer
    Dim kolom As Integer
   
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "2"
    Range("A1:B1").Select
    Selection.AutoFill Destination:=Range("A1:H1"), Type:=xlFillDefault
    Range("A1:H1").Select
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "3"
    Range("A1:A2").Select
    Selection.AutoFill Destination:=Range("A1:A20"), Type:=xlFillDefault
    Range("A1:A20").Select
    Range("B2").Select
    ActiveCell.FormulaR1C1 = "=R1C*RC1"
    Range("B2").Select
    Selection.AutoFill Destination:=Range("B2:H2"), Type:=xlFillDefault
    Range("B2:H2").Select
    Selection.AutoFill Destination:=Range("B2:H20"), Type:=xlFillDefault
    Range("B2:H20").Select
    Range("E11").Select
    ActiveCell.FormulaR1C1 = "1000"
    Range("A1").Select
    ' The code from here finds and selects the cell
    Range("A1:H20").Select
    Terbesar = -32768
    ActiveCell.SpecialCells(xlLastCell).Select
    For intRow = 1 To ActiveCell.Row
        For intCol = 1 To ActiveCell.Column
            If Cells(intRow, intCol).Value > Terbesar Then
                Terbesar = Cells(intRow, intCol).Value
                baris = intRow
                kolom = intCol
            End If
        Next
    Next
    Cells(baris, kolom).Select
End Sub


Udah dicoba? bagaima hasilnya? silakan tuliskan dikomentar jika ada pertanyaan Insya Allah jika saya mampu menjawab akan saya balas.

Tidak ada komentar:

Posting Komentar

LPJ BOS SMK Tahun Anggaran 2020

LPJ BOS SMK Tahun Anggaran 2020 User via SMS :  0857 5954 7892 FB :  https://web.facebook.com/iwan.kurniawanb Twitte...