Hi everyone, this is my first post, and I am NOT a proficient VBA programmer. For some of you this might be easy, but after 2 days, it is driving me nuts.
I have a combobox which is populated with folder names,, the folder names are month and year. eg Apr 2013, this works fine, no problems. The problem is, in the combobox list the months are in alphabetical order, I would like to sort them so that they run from Jan 2013 to Dec 2013.
All help appreciated, but PLEASE keep it relevant.
My code:
Private Sub CommandButton1_Click()
Dim name
Me.ComboBox2.Clear
For Each name In ListDirectory(Path:="C:\Users\Laurie\Documents\Pai Hotel\Log\Daily Log - Year 2013\", AttrInclude:=vbDirectory, AttrExclude:=vbSystem Or vbHidden)
If name Like "Jan*" Or name Like "Feb*" Or name Like "Mar*" Or name Like "Apr*" Or name Like "May*" Or name Like "Jun*" _
Or name Like "Jul*" Or name Like "Aug*" Or name Like "Sep*" Or name Like "Oct*" Or name Like "Nov*" Or name Like "Dec*" Then
Me.ComboBox2.AddItem name
End If
Next name
End Sub
Bookmarks