Microsoft Knowledge Base
Excel: How to Display Formatted Dates in a List Box
Last reviewed: September 12, 1996
Article ID: Q102858
The information in this article applies to:
- Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0
- Microsoft Excel for OS/2, version 2.2, 3.0
- Microsoft Excel for the Macintosh, version 2.x, 3.0, 4.0
SUMMARY
Normally, when you display dates in a list box in a dialog box, they appear in the serial number format. To display these dates in one of the date formats, use the TEXT() function in the dialog box definition table and specify the format you want to use.
NOTE: You can also use this method to apply other number formats to values displayed in a custom dialog box.
The following sample dialog box table displays a list of dates contained in the named range DLIST (in this dialog box, dates are displayed in their serial number formats, instead of in date formats):
X Posi- Y Posi- Init/ Item # tion tion Width Height Text Result ------ ------- ------- ------- ------- ---------- ------ B1: C1: D1: E1: 254 F1: 112 G1: H1: B2:15 C2: 10 D2: 6 E2: 160 F2: 84 G2: DLIST H2:
To display the list with date formats, replace the name DLIST in cell G2 with the following formula:
G2: TEXT(DLIST,"m/d/yy")
Explanation:
The TEXT() function calls DLIST and displays the numbers in that range in the m/d/yy date format.
NOTE: the information above also applies to version 5.0 only when using version 4.0 macro language.
REFERENCES
"Function Reference," version 4.0, pages 431-432 "Function Reference," version 3.0, pages 234-235
KBCategory: kbusage Last reviewed: September 12, 1996 |