Sort list
I have a list that I fill from information from other sheets and then I want
to sort the list how would I do that. I have tried and can't seem to get
sort to work.
Here is my code.
Private Sub CommandButton1_Click()
Dim wrksht As Worksheet
Dim oListCol As ListRow
Dim oList As ListObject
Dim oListSort As ListColumn
Dim sWork As String
Dim ListRange As Range
Set wrksht = ActiveWorkbook.Worksheets("Reports")
Set oList = wrksht.ListObjects(1)
For Each lsheet In Sheets
If (lsheet.Name < "Reports") Or (lsheet.Name < "Panels List") Or
(lsheet.Name < "Master") Then
Set oListCol = wrksht.ListObjects("list1").ListRows.Add
sWork = "=text('" & lsheet.Name & "'!b2,""#"")"
oListCol.Range.Cells(1, 1).Value = sWork
oListCol.Range.Cells(1, 2).Formula = "='" & lsheet.Name & "'!b112"
oListCol.Range.Cells(1, 3).Formula = "='" & lsheet.Name & "'!c112"
oListCol.Range.Cells(1, 4).Formula = "='" & lsheet.Name & "'!b113"
oListCol.Range.Cells(1, 5).Formula = "='" & lsheet.Name & "'!c113"
oListCol.Range.Cells(1, 6).Formula = "='" & lsheet.Name & "'!b114"
oListCol.Range.Cells(1, 7).Formula = "='" & lsheet.Name & "'!c114"
oListCol.Range.Cells(1, 8).Formula = "='" & lsheet.Name & "'!b115"
oListCol.Range.Cells(1, 9).Formula = "='" & lsheet.Name & "'!c115"
End If
Next
' want to sort list box now on column 1
End Sub
Thanks
Kirk Groome
|