You are on page 1of 3

Option Base 1

Dim nf As Integer

Dim nc As Integer

Dim i As Integer

Dim j As Integer

Dim mat() As Single

Private Sub CmdAceptar_Click()

nf = CInt(TxtNfil.Text)

nc = CInt(TxtNcol.Text)

ReDim mat(nf, nc) As Single

i=1

j=1

CmdElemento.Caption = "Elemento (" & i & ", " & j & ")"

CmdAceptar.Enabled = False

End Sub

Private Sub CmdDeterminante_Click()

For i = 1 To nf

For j = 1 To nc

Cells(i, j) = mat(i, j)

Next j

Next i

detval = Application.WorksheetFunction.MDeterm(Range(Cells(1, 1), Cells(nf, nc)))

Cells(nf, nc + 3) = detval

End Sub

Private Sub CmdElemento_Click()


mat(i, j) = CSng(TxtElemento.Text)

j=j+1

TxtElemento.Text = Clear

TxtElemento.SetFocus

CmdElemento.Caption = "Elemento ( " & i & "," & j & ") "

If j > nc Then

j=1

i=i+1

CmdElemento.Caption = "Elemento ( " & i & "," & j & ") "

If i > nf Then

CmdElemento.Caption = "Elemento (i,j)"

For i = 1 To nf

linea = " "

For j = 1 To nc

linea = linea & mat(i, j) & " "

Next j

LstMatriz.AddItem linea

Next i

End If

End If

End Sub

Private Sub CmdInverso_Click()

Range(Cells(nf + 3, 1), Cells(2 * nf + 2, nc)) =


Application.WorksheetFunction.MInverse(Range(Cells(1, 1), Cells(nf, nc)))

End Sub

You might also like