Con este código cargas en el form PGO de 20 a 25 segundos
Private Sub UserForm_Activate()
'Por.Dante Amor
cols = Array("C", "AB", "AA", "Z", "AC", "A", "E", "D", "F", "H", "G", "J")
For i = 3 To ActiveSheet.UsedRange.SpecialCells(11).Row
c = 0
For j = 13 To 24
agregar Me.Controls("ComboBox" & j), Cells(i, cols(c)).Text
c = c + 1
Next
Next
End Sub
Sub agregar(combo As ComboBox, dato As String)
'por.Dante Amor 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
Con este otro código, igual se cargan en el form PGO pero tarda 5 segundos.
Private Sub UserForm_Activate()
'Por.Dante Amor
Set h1 = Sheets("OBRAS")
Set h2 = Sheets("temp")
u = h1.UsedRange.SpecialCells(11).Row
h2.Cells.Clear
cols = Array("C", "AB", "AA", "Z", "AC", "A", "E", "D", "F", "H", "G", "J")
j = 13
For i = LBound(cols) To UBound(cols)
h1.Range(cols(i) & "3:" & cols(i) & u).Copy h2.[A1]
u2 = h2.Range("A" & Rows.Count).End(xlUp).Row
h2.Range("A1:A" & u2).RemoveDuplicates Columns:=1, Header:=xlNo
With h2.Sort
.SortFields.Clear
.SortFields.Add Key:=h2.Range("A1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortTextAsNumbers
.SetRange h2.Range("A1:A" & u2)
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
u2 = h2.Range("A" & Rows.Count).End(xlUp).Row
'Set rango = h2.Range("A1:A" & u2)
Me.Controls("ComboBox" & j).List = h2.Range("A1:A" & u2).Cells.Value
j = j + 1
Next
End Sub