chipsworld
Board Regular
- Joined
- May 23, 2019
- Messages
- 164
- Office Version
- 365
All...I found the below on this site, and it works beautifully, but...
Was wondering if there is anyway to mod the code to filter two separate columns? i.e. First by Date, then by Name (Columns 15 and then 2)
Any help would be greatly appreciated. This is a hard code sort...no checks, combo boxes, etc....
Trying to not re-invent the wheel if possible... I have this embedded in the sub to load the listbox, and it works perfectly. Just wanted to see how complicated it would be to expand it capabilities.
Was wondering if there is anyway to mod the code to filter two separate columns? i.e. First by Date, then by Name (Columns 15 and then 2)
Any help would be greatly appreciated. This is a hard code sort...no checks, combo boxes, etc....
Trying to not re-invent the wheel if possible... I have this embedded in the sub to load the listbox, and it works perfectly. Just wanted to see how complicated it would be to expand it capabilities.
VBA Code:
Dim vData As Variant
Dim vTemp As Variant
Dim i As Long
Dim j As Long
Dim k As Long
Dim SortByCol As Long
SortByCol = 15 ' sort by date created
With Me.lstboxchoice
vData = .List
For i = LBound(vData, 1) To UBound(vData, 1) - 1
For j = i + 1 To UBound(vData, 1)
If vData(i, SortByCol) < vData(j, SortByCol) Then
For k = LBound(vData, 2) To UBound(vData, 2)
vTemp = vData(i, k)
vData(i, k) = vData(j, k)
vData(j, k) = vTemp
Next k
End If
Next j
Next i
.List = vData
End With