ERROR EN LISTBOX
Publicado por Michael Elvis (16 intervenciones) el 18/12/2020 17:58:08
Buenos días a todos, tengo un Listbox en el cual deseo ordenar de menor a mayor, pero al ejecutar me arroja un error: no se puede configurar la propiedad list. permiso denegado, a continuación les muestro el código: (el error es en la siguiente línea: .List(i, x) = .List(i + 1, x)).


Gracias.


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
Private Sub Cmb_Ordenar_Click()
Dim i, j As Long
Dim x As Long
Dim Valor1 As Double
Dim Valor2 As Double
Dim Temp As String
With ListBox1
For j = 1 To ListBox1.ListCount
For i = LBound(.List) To UBound(.List) - 1 Step 1
If i = 0 Then
i = 1
End If
Valor1 = .List(i, 3) 'fila 1
Valor2 = .List(i + 1, 3) 'fila 2
If Valor1 > Valor2 Then
For x = 0 To ListBox1.ColumnCount - 1
Temp = .List(i, x)
.List(i, x) = .List(i + 1, x) (AQUÍ ES DONDE ES EL ERROR
.List(i + 1, x) = Temp
Next
End If
Next i
Next j
End With
end sub
Gracias.
Valora esta pregunta


0