Te anexo el código
Dim hb, ht
'
Private Sub ComboBox1_Change()
'Por.Dante Amor
TextBox1 = ""
ComboBox2.Clear
ListBox1.RowSource = ""
If ComboBox1 = "" Or ComboBox1.ListIndex = -1 Then
Call PonerTodo
Exit Sub
End If
'
'carga combo2
col = Val(ComboBox1.List(ComboBox1.ListIndex, 1))
For i = 3 To hb.Cells(Rows.Count, col).End(xlUp).Row
Call Agregar(ComboBox2, hb.Cells(i, col))
Next
End Sub
'
Sub Agregar(combo As ComboBox, dato As String)
'por.DAM agrega los item únicos y en orden alfabético
For i = 0 To combo.ListCount - 1
Select Case StrComp(combo.List(i), dato, vbTextCompare)
Case 0: Exit Sub 'ya existe en el combo y ya no lo agrega
Case 1: combo.AddItem dato, i: Exit Sub 'Es menor, lo agrega antes del comparado
End Select
Next
combo.AddItem dato 'Es mayor lo agrega al final
End Sub
'
Private Sub ComboBox2_Change()
'
TextBox1 = ""
ListBox1.RowSource = ""
If ComboBox2 = "" Or ComboBox2.ListIndex = -1 Then
Call PonerTodo
Exit Sub
End If
'
Application.ScreenUpdating = False
ht.Cells.Clear
hb.Rows(2).Copy ht.Rows(1)
'ultima fila y columna de buscador
uf = hb.Range("A" & Rows.Count).End(xlUp).Row
uc = hb.Cells(2, Columns.Count).End(xlToLeft).Column
'pone los criterios después de la ultima columna
col = Val(ComboBox1.List(ComboBox1.ListIndex, 1))
ht.Cells(1, uc + 2) = hb.Cells(2, col)
ht.Cells(2, uc + 2) = ComboBox2
'
hb.Range("A2", hb.Cells(uf, uc)).AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=ht.Range(ht.Cells(1, uc + 2), ht.Cells(2, uc + 2)), _
CopyToRange:=ht.Range("A1:C1"), Unique:=False
ut = ht.Range("A" & Rows.Count).End(xlUp).Row
rango = ht.Range("A2:C" & ut).Address
ht.Columns("A:C").EntireColumn.AutoFit
For k = 1 To Columns("C").Column
ancho = ancho & Int(ht.Cells(1, k).Width) + 2 & ";"
Next
wsuma = WorksheetFunction.Sum(ht.Range("C2:C" & ut))
ListBox1.RowSource = ht.Name & "!" & rango
ListBox1.ColumnWidths = ancho
TextBox1 = wsuma
Application.ScreenUpdating = True
End Sub
'
Private Sub UserForm_Activate()
'Por Dante Amor
'
'carga el combo1 con los procesos de la hoja "buscador" fila 2
Set hb = Sheets("Buscador")
Set ht = Sheets("Temp")
For i = 1 To hb.Cells(2, Columns.Count).End(xlToLeft).Column
enca = LCase(Left(hb.Cells(2, i), 7))
If LCase(Left(hb.Cells(2, i), 7)) = LCase("proceso") Then
ComboBox1.AddItem hb.Cells(2, i)
ComboBox1.List(ComboBox1.ListCount - 1, 1) = i
End If
Next
Call PonerTodo
End Sub
'
Sub PonerTodo()
ub = hb.Range("A" & Rows.Count).End(xlUp).Row
rango = hb.Range("A3:C" & ub).Address
hb.Columns("A:C").EntireColumn.AutoFit
For k = 1 To Columns("C").Column
ancho = ancho & Int(hb.Cells(1, k).Width) + 2 & ";"
Next
wsuma = WorksheetFunction.Sum(hb.Range("C3:C" & ub))
ListBox1.RowSource = hb.Name & "!" & rango
ListBox1.ColumnWidths = ancho
TextBox1 = wsuma
End Sub
'
Private Sub Image1_Click()
Unload Me
End Sub
.
. S aludos. Dante Amor. R ecuerda valorar la respuesta. G racias
.