ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,731
- Office Version
- 2007
- Platform
- Windows
On my worksheet i currently have 2048 rows.
In column G the date is added once the parcel has been delivered BUT until then the word POSTED is shown.
When i open my userform NameForDateEntryBox is populated from all customers which have POSTED shown please see screenshot
As you will see that the still awaiting parcels to be delivered start at the top & go down the list,so old date doing down the list to latest date.
My goal is to reverse this so lastest dates start first & older dates are towards the bottome.
Code shown is what populates the list.
I changed XlUp to XlDown but didnt work so obvioulsy dont understand its use.
In column G the date is added once the parcel has been delivered BUT until then the word POSTED is shown.
When i open my userform NameForDateEntryBox is populated from all customers which have POSTED shown please see screenshot
As you will see that the still awaiting parcels to be delivered start at the top & go down the list,so old date doing down the list to latest date.
My goal is to reverse this so lastest dates start first & older dates are towards the bottome.
Code shown is what populates the list.
I changed XlUp to XlDown but didnt work so obvioulsy dont understand its use.
Rich (BB code):
Private Sub populate()
' clear the combobox
Me.NameForDateEntryBox.Clear
' declare variables
Dim i As Long, lRow As Long, ws As Worksheet
' set ws to the desired sheet
Set ws = Application.Worksheets("POSTAGE")
' determine the last row of that desired sheet
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
' populate the combobox by looping down the rows of ws
With Me.NameForDateEntryBox
For i = 8 To lRow
'determine if this customer should be added to combobox list
If UCase(ws.Cells(i, 7).Value) = "POSTED" Then
.AddItem Cells(i, 2) 'adds the customer name to combobox first column
.List(.ListCount - 1, 1) = Cells(i, 1) 'add the date to second column of line just added
.List(.ListCount - 1, 2) = Cells(i, 3) 'add the item to third column of line just added
End If
Next i
End With
End Sub