El subíndice está fuera del intervalo (Error 9) VBA 6
Publicado por Dany89 (2 intervenciones) el 20/11/2018 07:44:42
Qué tal? Espero me puedan ayudar, tengo un problema al momento de ejecutar uno de mis primeros programas, se trata de un programa para mostrar 5 números ingresados con el evento keypress en un textbox y con un botón de comando mostrarlos en un listbox, posteriormente ordenarlos con un boton, para no haceros pelotas les adjunto el código.
Consta de un textbox, dos botones y dos listbox, los cuales uno muestra los números ingresados como tal y el otro para mostrarlos ordenados de menor a mayor.
Disculpen las molestias :-C
Consta de un textbox, dos botones y dos listbox, los cuales uno muestra los números ingresados como tal y el otro para mostrarlos ordenados de menor a mayor.
Disculpen las molestias :-C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Option Explicit
Dim x(4) As Integer
Dim c As Integer
Dim y As Integer
Dim i As Integer
Private Sub Command1_Click()
For i = 0 To 4
List1.AddItem ("N" & i + 1 & "=" & x(i))
If i = 4 Then
Command2.Enabled = True
Command1.Enabled = False
End If
Next
c = 0
i = 0
End Sub
Private Sub Command2_Click()
If x(c) >= x(c + 1) Then
y = x(c)
x(c) = x(c + 1)
x(c + 1) = y
c = c + 1
Else
c = c + 1
End If
If c = 4 Then
i = i + 1
c = 0
End If
If i = 4 Then
For c = 0 To 4
List2.AddItem ("N" & c + 1 & "=" & x(c))
Next
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
x(c) = Val(Text1.Text)
c = c + 1
Text1.Text = ""
If c = 5 Then
Text1.Enabled = False
Command1.Enabled = True
End If
End If
End Sub
Valora esta pregunta


0