Archive of Mr Excel Message Board


Back to Dates in Excel archive index
Back to archive home

excel date formatting

Posted by Basil Thomas on July 23, 2001 1:47 PM
how do you format a cell to a particular date format
using VBA code?

Re: excel date formatting

Posted by Alex on July 24, 2001 4:09 AM

Basil,

Try something like...

Sub dateformatting()
' Select the range you need to format
Range("A1").Select
' Format it however you need to, e.g.
Selection.NumberFormat = "mm/dd/yy"
End Sub

Alex


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.