fernande, como nas colunas que citou as quantidades de linhas são diferentes, o ideal é fazer uma rotina para cada combo e chama-las no Initialize do Formuçário, troque pelas rotinas abaixo e veja se é isto :
Private Sub UserForm_Initialize()
Call Combo_CdRp
Call Combo_Cd_Status
Call Combo_CdSegmento
End Sub
Sub Combo_CdRp()
Dim OCOLLECTION As New Collection
Dim VARVALUE As Variant
Dim i, ULTLINHA As Long
Me.CdRp.Clear
ULTLINHA = Sheets("PQ").Range("C1048576").End(xlUp).Row
On Error Resume Next
For Each VARVALUE In Sheets("PQ").Range("C5:C" & ULTLINHA)
If VARVALUE <> "" Then
OCOLLECTION.Add CStr(VARVALUE), CStr(VARVALUE)
End If
Next
For i = 1 To OCOLLECTION.Count
CdRp.AddItem OCOLLECTION.Item(i)
Next
Call ordenarcombobox
End Sub
Sub Combo_Cd_Status()
Dim OCOLLECTION As New Collection
Dim VARVALUE As Variant
Dim i, ULTLINHA As Long
Me.Cd_Status.Clear
ULTLINHA = Sheets("PQ").Range("B1048576").End(xlUp).Row
On Error Resume Next
For Each VARVALUE In Sheets("PQ").Range("B5:B" & ULTLINHA)
If VARVALUE <> "" Then
OCOLLECTION.Add CStr(VARVALUE), CStr(VARVALUE)
End If
Next
For i = 1 To OCOLLECTION.Count
Cd_Status.AddItem OCOLLECTION.Item(i)
Next
Call ordenarcombobox
End Sub
Sub Combo_CdSegmento()
Dim OCOLLECTION As New Collection
Dim VARVALUE As Variant
Dim i, ULTLINHA As Long
Me.CdSegmento.Clear
ULTLINHA = Sheets("PQ").Range("E1048576").End(xlUp).Row
On Error Resume Next
For Each VARVALUE In Sheets("PQ").Range("E5:E" & ULTLINHA)
If VARVALUE <> "" Then
OCOLLECTION.Add CStr(VARVALUE), CStr(VARVALUE)
End If
Next
For i = 1 To OCOLLECTION.Count
CdSegmento.AddItem OCOLLECTION.Item(i)
Next
Call ordenarcombobox
End Sub
Sub ordenarcombobox()
Dim iforsta, isista As Integer
Dim i, j As Integer
Dim stemp As String
iforsta = 0
isista = CdRp.ListCount - 1
For i = iforsta To isista - 1
For j = i + 1 To isista
If CdRp.List(i) > CdRp.List(j) Then
stemp = CdRp.List(j)
CdRp.List(j) = CdRp.List(i)
CdRp.List(i) = stemp
End If
Next j
Next i
End Sub
[]s
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 09/09/2016 1:26 pm