Matriz
Quisiera que me expliques porque me tira un error. Lo que quiero hacer es ingresar dos valores y que los busque en la matriz, para devolverme el valor que se encuentra en dicha posición.
Gracias!
'Option Explicit
Public columna As Integer
Public Sub Form_Load()
Dim planilla(3, 3) As Integer
planilla(0, 0) = 0
planilla(0, 1) = 3
planilla(0, 2) = 8
planilla(0, 3) = 20
planilla(1, 0) = 5
planilla(1, 1) = 2
planilla(1, 2) = 4
planilla(1, 3) = 9
planilla(2, 0) = 6
planilla(2, 1) = 7
planilla(2, 2) = 12
planilla(2, 3) = 18
planilla(3, 0) = 15
planilla(3, 1) = 16
planilla(3, 2) = 17
planilla(3, 3) = 30
End Sub
Function calculo(lontxt1 As Integer, cautxt2 As Integer, planilla() As Integer) As Integer
Dim i As Integer
Dim fila As Integer
Dim j As Integer
Dim diametro As Integer
For i = 0 To 3 Step 1
If lontxt1 = planilla(i, 0) Then
fila = i
'Else
' If lontxt1 < planilla(i, 0) Then
'fila = i
End If
Next i
For j = 0 To 3 Step 1
If cautxt2 = planilla(fila, j) Then
columna = j
'Else
' If cautxt2 < planilla(fila, j) Then
' columna = j
End If
Next j
diametro = planilla(0, columna)
calculo = diametro
End Function
Private Sub cmb1_Click()
Dim diametro As Integer
Dim caudal As Integer
Dim arrays() As Integer
diatxt3 = calculo(diametro, caudal, arrays())
End Sub
Gracias!
'Option Explicit
Public columna As Integer
Public Sub Form_Load()
Dim planilla(3, 3) As Integer
planilla(0, 0) = 0
planilla(0, 1) = 3
planilla(0, 2) = 8
planilla(0, 3) = 20
planilla(1, 0) = 5
planilla(1, 1) = 2
planilla(1, 2) = 4
planilla(1, 3) = 9
planilla(2, 0) = 6
planilla(2, 1) = 7
planilla(2, 2) = 12
planilla(2, 3) = 18
planilla(3, 0) = 15
planilla(3, 1) = 16
planilla(3, 2) = 17
planilla(3, 3) = 30
End Sub
Function calculo(lontxt1 As Integer, cautxt2 As Integer, planilla() As Integer) As Integer
Dim i As Integer
Dim fila As Integer
Dim j As Integer
Dim diametro As Integer
For i = 0 To 3 Step 1
If lontxt1 = planilla(i, 0) Then
fila = i
'Else
' If lontxt1 < planilla(i, 0) Then
'fila = i
End If
Next i
For j = 0 To 3 Step 1
If cautxt2 = planilla(fila, j) Then
columna = j
'Else
' If cautxt2 < planilla(fila, j) Then
' columna = j
End If
Next j
diametro = planilla(0, columna)
calculo = diametro
End Function
Private Sub cmb1_Click()
Dim diametro As Integer
Dim caudal As Integer
Dim arrays() As Integer
diatxt3 = calculo(diametro, caudal, arrays())
End Sub
1 Respuesta
Respuesta de intman
1