Combobox no pasa de los espacios en blanco, no muestra toda la lista de datos.
Publicado por Oscar (14 intervenciones) el 01/02/2020 16:56:13
Gracias por la buena disposición a querer ayudar.
Esta mi tercera consulta en mi necesidad de corregir defectos en mi libro de excel que uso con mucha frecuencia.
No tengo muchos conocimientos de programcion y aunque le he dedicado mucho tiempo, no me ha sido posible solucionar este detalle.
En mi userform tengo un combobox: "Private Sub cbomiembros_Change()"
Sucede que cuando en el rango desde donde se carga hay un espacio vacío, solo muestra lo que stá antes del vacío, no carga lo de abajo.
De antemano, muchas gracias por la ayuda que me puedan brindar.
(Dejo el codigo completo del formulario, por si acaso).

Esta mi tercera consulta en mi necesidad de corregir defectos en mi libro de excel que uso con mucha frecuencia.
No tengo muchos conocimientos de programcion y aunque le he dedicado mucho tiempo, no me ha sido posible solucionar este detalle.
En mi userform tengo un combobox: "Private Sub cbomiembros_Change()"
Sucede que cuando en el rango desde donde se carga hay un espacio vacío, solo muestra lo que stá antes del vacío, no carga lo de abajo.
De antemano, muchas gracias por la ayuda que me puedan brindar.
(Dejo el codigo completo del formulario, por si acaso).
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
' </> --------------------------------------------------------------------- </>
' </> ---&--- INICIO
' </> --------------------------------------------------------------------- </>
Private Sub UserForm_Activate()
Dim FILA As Integer
Me.cboMes.AddItem "Enero"
Me.cboMes.AddItem "Febrero"
Me.cboMes.AddItem "Marzo"
Me.cboMes.AddItem "Abril"
Me.cboMes.AddItem "Mayo"
Me.cboMes.AddItem "Junio"
Me.cboMes.AddItem "Julio"
Me.cboMes.AddItem "Agosto"
Me.cboMes.AddItem "Septiembre"
Me.cboMes.AddItem "Octubre"
Me.cboMes.AddItem "Noviembre"
Me.cboMes.AddItem "Diciembre"
FILA = 9 'Inserta en el combobox los nombres de publicadores
While Cells(FILA, "C") <> ""
cbomiembros.AddItem Cells(FILA, "C"): FILA = FILA + 1
Wend
End Sub
' </> --------------------------------------------------------------------- </>
' </> ---&--- BOTON SALIR
' </> --------------------------------------------------------------------- </>
Private Sub cmdCancel_Click()
Call Unload(Me)
Call Proteger
End Sub
' </> --------------------------------------------------------------------- </>
' </> ---&--- BOTON ACEPTAR
' </> --------------------------------------------------------------------- </>
Private Sub cmdIng_Click()
Dim m_row As Integer, bl_continuar As Boolean, i As Integer
If cboMes.Text = Empty Then
Me.cboMes.SetFocus
Beep
Exit Sub
Call Proteger
End If
If cbomiembros.Text = Empty Then
cbomiembros.SetFocus
Beep
Exit Sub
Call Proteger
End If
Call Columns("C:C").Select
Call Range("C5").Activate
Selection.Find(What:=Me.cbomiembros.Text, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
m_row = ActiveCell.Row
ActiveCell.Interior.Color = RGB(0, 250, 0)
ActiveSheet.Unprotect
Dim Mes As String, Busco_Mes As Range, Rango_Mes As String, _
Nom As String, Busco_Nom As Range, Rango_Nom As String
Mes = UCase(cboMes.Text)
Nom = cbomiembros.Text
Rango_Mes = "A2:Cu2"
Rango_Nom = "A6:F" & ActiveSheet.Range("C" & Rows.Count).End(xlUp).Row
Set Busco_Mes = ActiveSheet.Range(Rango_Mes).Find(What:=Mes, LookAt:=xlPart)
Set Busco_Nom = ActiveSheet.Range(Rango_Nom).Find(What:=Nom, LookAt:=xlPart)
Cells(Busco_Nom.Row, Busco_Mes.Column).Select
'comprobamos si hay valores previos
bl_continuar = True
With ActiveCell
For i = 0 To 6
'Eliminar este segmento para habilitar comprob. bl_continuar = bl_continuar And IsEmpty(.Offset(0, I))
Next
End With
'Detecta si combobox PS esta vacio
If Me.[CBO_PS] = "" Then 'Cambiar [D11] por la celda que contenga el n° de registro que se quiere reemplazar
MsgBox "Falta indicar Privilegio de servicio" 'Mensaje que se muestra si Textbox PS está vacío y evita continuar
Exit Sub
End If
If bl_continuar Then
ActiveCell.Offset(0, 0).Value = Me.CBO_PS.Value 'Inserta seleccion del CBO:PS
ActiveCell.Offset(0, 1).Value = Me.D_1.Text
ActiveCell.Offset(0, 2).Value = Me.D_2.Text
ActiveCell.Offset(0, 3).Value = Me.D_3.Text
ActiveCell.Offset(0, 4).Value = Me.D_4.Text
ActiveCell.Offset(0, 5).Value = Me.D_5.Text
ActiveCell.Offset(0, 6).Value = Me.D_6.Text
MsgBox "Los datos se guardarón correctamente", vbInformation
Else
MsgBox "Hay contenidos en la hoja" & vbCrLf & _
"No se anotan para no sobrescribirlos", vbOKOnly + vbExclamation
Call Proteger
End If
Call Unload(Me)
End sub
' Combobox:
Private Sub cbomiembros_Change()
On Error Resume Next
TextBox1.Value = Application.WorksheetFunction.VLookup(Trim(cbomiembros.Value), Range("C:H"), 5, 0)
End Sub

Valora esta pregunta


0