Comboclick no funciona
Tengo 2 combocliks en un userform que llevan el item seleccionado a un textbox.
Uno de ellos funciona perfecto, pero el 2do, no se que le pasa...
Este es el codigo:
'PARA ELEGIR EL CUATRIMESTRE
Private Sub ComboBox1_Click()
Dim i As Integer
Dim final As Integer
For i = 1 To 1000
If Hoja4.Cells(i, 2) = "" Then
final = i - 1
Exit For
End If
Next
For i = 1 To final
If ComboBox1 = Hoja4.Cells(i, 2) Then
TextBox1 = Hoja4.Cells(i, 2)
Exit For
End If
Next
End Sub
Private Sub ComboBox1_Enter()
Dim i As Integer
Dim j As Integer
Dim h As Integer
Dim final As Integer
Dim tareas As String
ComboBox1.BackColor = &H80000005
For i = 1 To ComboBox1.ListCount
ComboBox1.RemoveItem 0
Next
For j = 1 To 1000
If Hoja4.Cells(j, 2) = "" Then
final = j - 1
Exit For
End If
Next
For h = 1 To final
tareas = Hoja4.Cells(h, 2)
ComboBox1.AddItem (tareas)
Next
End Sub
Private Sub ComboBox2_Enter()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim final2 As Integer
Dim tareas2 As String
ComboBox2.BackColor = &H80000005
For a = 1 To ComboBox2.ListCount
ComboBox2.RemoveItem 0
Next
For b = 1 To 1000
If Hoja4.Cells(b, 3) = "" Then
final2 = b - 1
Exit For
End If
Next
For c = 1 To final2
tareas2 = Hoja4.Cells(c, 3)
ComboBox2.AddItem (tareas2)
Next
End Sub
'HASTA AQUI FUNCIONA....
'ESTA PARTE YA NO ME FUNCIONA....
'PARA ELEGIR EL AÑO
Private Sub ComboBox2_Click()
Dim a As Integer
Dim final2 As Integer
For a = 1 To 1000
If Hoja4.Cells(a, 3) = "" Then
final2 = a - 1
Exit For
End If
Next
For a = 1 To final2
If ComboBox2 = Hoja4.Cells(a, 3) Then
TextBox2 = Hoja4.Cells(a, 3)
Exit For
End If
Next
End Sub
PD: le envié por email el archivo con el ejemplo
Desde ya gracias por la ayuda...
Uno de ellos funciona perfecto, pero el 2do, no se que le pasa...
Este es el codigo:
'PARA ELEGIR EL CUATRIMESTRE
Private Sub ComboBox1_Click()
Dim i As Integer
Dim final As Integer
For i = 1 To 1000
If Hoja4.Cells(i, 2) = "" Then
final = i - 1
Exit For
End If
Next
For i = 1 To final
If ComboBox1 = Hoja4.Cells(i, 2) Then
TextBox1 = Hoja4.Cells(i, 2)
Exit For
End If
Next
End Sub
Private Sub ComboBox1_Enter()
Dim i As Integer
Dim j As Integer
Dim h As Integer
Dim final As Integer
Dim tareas As String
ComboBox1.BackColor = &H80000005
For i = 1 To ComboBox1.ListCount
ComboBox1.RemoveItem 0
Next
For j = 1 To 1000
If Hoja4.Cells(j, 2) = "" Then
final = j - 1
Exit For
End If
Next
For h = 1 To final
tareas = Hoja4.Cells(h, 2)
ComboBox1.AddItem (tareas)
Next
End Sub
Private Sub ComboBox2_Enter()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim final2 As Integer
Dim tareas2 As String
ComboBox2.BackColor = &H80000005
For a = 1 To ComboBox2.ListCount
ComboBox2.RemoveItem 0
Next
For b = 1 To 1000
If Hoja4.Cells(b, 3) = "" Then
final2 = b - 1
Exit For
End If
Next
For c = 1 To final2
tareas2 = Hoja4.Cells(c, 3)
ComboBox2.AddItem (tareas2)
Next
End Sub
'HASTA AQUI FUNCIONA....
'ESTA PARTE YA NO ME FUNCIONA....
'PARA ELEGIR EL AÑO
Private Sub ComboBox2_Click()
Dim a As Integer
Dim final2 As Integer
For a = 1 To 1000
If Hoja4.Cells(a, 3) = "" Then
final2 = a - 1
Exit For
End If
Next
For a = 1 To final2
If ComboBox2 = Hoja4.Cells(a, 3) Then
TextBox2 = Hoja4.Cells(a, 3)
Exit For
End If
Next
End Sub
PD: le envié por email el archivo con el ejemplo
Desde ya gracias por la ayuda...
1 Respuesta
Respuesta de hugolaza
1