View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Combo Box question

hi
technically this is more a for next question than a combo box question
but....hey...
you will have to modify your for next loop and add a couple of lines....
Dim c As Range
Set c = Range("A65000").End(xlUp) 'or find end of Datelist
For i = Range("datelist").Rows.Count To 1 Step -1
If c < c.Offset(-1, 0) Then
Me.cBoxDates.AddItem Format(c, "m/d/yyyy")
Set c = c.Offset(-1, 0) ' move up 1
End If
Next

i have comments on the lines you need to add with explinations

regards
FSt1

"Sam" wrote:

I have a list of dates that has several of the same date, however they are in
chronological order, named DateList. A combo box in a userform displays these
with the UserForm_Initialize event:

For each c in Range("DateList")
If c < c.Offset(-1, 0) Then
Me.cBoxDates.AddItem Format(c, "m/d/yyyy")
End If
Next

How can I get the combo box to display the dates in reverse order (latest to
earliest) if the list is earliest to latest?

Thanks,

Sam