Friday, February 12, 2010

Excel ActiveX control: How to change the date format in Listbox?

I have used the ActiveX Listbox control to show dates in the list. The data being fetched is in dd.mmm.yy format, therefore, showing the values in the list in the same format (dd.mmm.yyy). I want to change the date format ONLY IN LIST without changing the format of the source data. Can anyone please offera solution to this simple problem? ThanksExcel ActiveX control: How to change the date format in Listbox?
You might check out the FormatDateTime function:


you have only two options: short data and long date, but at least they're different.





Assuming that you're using the following statement type to populate the listbox: (source data in col K)





ListBox.AddItem Range(';K'; %26amp; i).Value ' i as loop variable)





The new statement would become





ListBox.AddItem FormatDateTime(Range(';K'; %26amp; i).Value,vbLongDate))





You could also further process the source data with theWeekdayName function.





Hope that helps
  • skin problems
  • No comments:

    Post a Comment