Twitter

Senin, 05 November 2012

Membuat Macro Pada Ms.Excel ( Matriks,Kali & Invers )

Berikut merupakan langkah-langkah membuat Invers,Kali & Matriks Pada Ms.Excel :


  1. buka Ms.Excel
  2. masukan angka-angka seperti gambar berikut ini :
( masukan angka yang "SOAL" saja )

  • masukan coding :
Sub Invers()
Dim A(10, 10)
'BACA DATA
For I = 1 To Cells(1, 2)
    For J = 1 To Cells(1, 2)
        A(I, J) = Cells(2 + I, 1 + J)
    Next J
Next I
'INVERS
For I = 1 To Cells(1, 2)
    b = A(I, I)
    A(I, I) = 1
    For J = 1 To Cells(1, 2)
        A(I, J) = A(I, J) / b
    Next J
    For K = 1 To Cells(1, 2)
        If (K <> I) Then
        t = A(K, I)
        A(K, I) = 0
        For x = 1 To Cells(1, 2)
            A(K, x) = A(K, x) - A(I, x) * t
        Next x
    End If
Next K
Next I
'CETAK
For I = 1 To Cells(1, 2)
    For J = 1 To Cells(1, 2)
        Cells(12 + I, 1 + J) = A(I, J)
    Next J
Next I
End Sub
Sub kali()
Dim A(10, 10), b(10, 10), c(10, 10)
For I = 1 To Cells(1, 2)
    For J = 1 To Cells(1, 2)
        A(I, J) = Cells(2 + I, 1 + J)
        b(I, J) = Cells(12 + I, 1 + J)
    Next J
Next I
For I = 1 To Cells(1, 2)
    For J = 1 To Cells(1, 2)
    c(I, J) = 0
        For K = 1 To Cells(1, 2)
        c(I, J) = c(I, J) + A(I, K) * b(K, J)
        Next K
            Cells(19 + I, 1 + J) = c(I, J)
    Next J
Next I
End Sub


  • Lalu Jalankan program tersebut dengan mengklik icon PLAY berwarna HIJAU,
  • kemudian buka Ms.Excel tadi.

ini contoh codingnya :



~ Semoga Bermanfaat bagi Anda ~

0 komentar:

Posting Komentar

Template by:

Free Blog Templates