Listbox populate with two combo date and time format

asyamonique

Well-known Member
Joined
Jan 29, 2008
Messages
1,286
Office Version
  1. 2013
Platform
  1. Windows
Code:
Application.ScreenUpdating = False

Dim r As Long, Ac As Long, c As Long
  If ComboBox10.Value <> -1 And ComboBox11.Value <> -1 Then
        ListBox2.Clear
        With Worksheets("taxibyname").Range("A1:A5000")
           ReDim Ray(1 To .Count, 1 To 11)
            For r = 1 To .Rows.Count
               With ListBox2
                    .ColumnCount = 11
                    .ColumnWidths = "0;80;80;200;200;140;120;100;60;0;0"
                End With
                If ComboBox10.Value = .Cells(r, 1).Value And ComboBox11.Value = .Cells(r, 2).Value Then
                   c = c + 1
                   For Ac = 1 To 11
                        Ray(c, Ac) = .Cells(r, Ac)
                   Next Ac
                End If
            Next r
        End With
End If
ListBox2.List = Ray


Application.ScreenUpdating = True


Hello,
Could you please help me with that code given above?
Column C "Date"and D "hrs" entries, I need to format that columns at listbox as "dd-mmm-yyyy" and "h:mm"
Also the progres gets long time to populate listbox is there any solution to fix that problem to make it shorter?
Many thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,224,828
Messages
6,181,217
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top