How to change date format in listbox and combobox

EzzatHesham

New Member
Joined
Jun 10, 2022
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hello, everyone
I made an userform for filtering data based on dates. The userform has 1combobox it contains the dates data and its placed in: sheet7.range("h2:h69").
and 1listbox it contains the filtered data and its placed in:
Sheet9.range("l1").currentregion.
And that data showed in listbox contains another dates in column (m) in sheet and column 2 in listbox.
My problem is the date format.
Dates appears in combobox and listbox like (mm-dd-yyyy).
Any help to fix it to appears (dd-mm-yyyy)
Thanks.💜😊
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
You should change the way the combobox and listbox are loaded, to something like this:

Rich (BB code):
Private Sub UserForm_Activate()
  Dim c As Range
  Dim i As Long
  
  For Each c In Sheet7.Range("H2:H69")
    ComboBox1.AddItem Format(c.Value, "dd/mm/yyyy")
  Next
  
  With ListBox1
    For i = 1 To Sheet9.Range("M" & Rows.Count).End(3).Row
      .AddItem
      .List(.ListCount - 1, 0) = Sheet9.Range("I" & i).Value
      .List(.ListCount - 1, 1) = Format(Sheet9.Range("M" & i).Value, "dd/mm/yyyy")
    Next
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

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