Matrices
Hola!
Quisiera que me expliques porque me tira un error al querer compilar. El error me lo tira en planilla(0, 0) = 0. Soy nuevo en esto y recién me estoy iniciando. Si me podes recomendar algún tutorial o algo parecido que este on-line te lo agradecería. Muchas Gracias por tu tiempo!
'Option Explicit
Dim planilla(4, 4) 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
Function calculo(lontxt1 As Double, cau As Double) As Double
Dim i As Integer
Dim fila As Integer
Dim cano As Integer
Dim j As Integer
Dim caudal As Integer
Dim columna As Integer
'Dim diametrocano As Integer
For i = 0 To 4 Step 1
If lontxt1 = planilla(i, 0) Then
fila = i
Else
If cano < planilla(i, 0) Then
fila = i
Next i
For j = 0 To 4 Step 1
If caudal = planilla(fila, j) Then
columna = j
Else
If caudal < planilla(fila, j) Then
columna = j
Next j
calculo = planilla(0, columna)
'return(diametrocano);
End Function
Private Sub diatxt3_Change()
diatxt3 = calculo(0, columna)
End Sub
Quisiera que me expliques porque me tira un error al querer compilar. El error me lo tira en planilla(0, 0) = 0. Soy nuevo en esto y recién me estoy iniciando. Si me podes recomendar algún tutorial o algo parecido que este on-line te lo agradecería. Muchas Gracias por tu tiempo!
'Option Explicit
Dim planilla(4, 4) 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
Function calculo(lontxt1 As Double, cau As Double) As Double
Dim i As Integer
Dim fila As Integer
Dim cano As Integer
Dim j As Integer
Dim caudal As Integer
Dim columna As Integer
'Dim diametrocano As Integer
For i = 0 To 4 Step 1
If lontxt1 = planilla(i, 0) Then
fila = i
Else
If cano < planilla(i, 0) Then
fila = i
Next i
For j = 0 To 4 Step 1
If caudal = planilla(fila, j) Then
columna = j
Else
If caudal < planilla(fila, j) Then
columna = j
Next j
calculo = planilla(0, columna)
'return(diametrocano);
End Function
Private Sub diatxt3_Change()
diatxt3 = calculo(0, columna)
End Sub
1 Respuesta
Respuesta de intman
1