• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Column in MM/DD/YYYY format

Abdulassees

New Member
Hi Team,

I wanted to set a column MM-DD-YYYY format , whenever I run the marco. can you help me how can be done that.



Thanks in advance for your great support.

Regards,
Abdul
 
Something like this.
Code:
Sub dFormat()

With ActiveSheet.Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
    .NumberFormat = "MM-DD-YYYY"
End With
End Sub

You can either add this piece to your code or call it. Adjust column reference as needed.

Edit: Removed Dim part as it's not necessary. Just force of habit.
 
Last edited:
Select the cell or cells that you want to apply the date format to and tap Ctrl+1. When the Format Cells dialog opens, go to the Number tab and select Date from the left hand Category: list. Select 03/14/01 from the Type: list on the right and click OK in the lower right.

Edit: it has occurred to me that your regional setting may default the date formats available from mm/dd/yy todd/mm/yy, If this is the case, select Custom from the left hand Category: list and manually type in mm/dd/yy to theType: text box. Click OK to accept the new custom number format.

You can also set the system wide defaults for regional date, currency, etc. through the Control Panel's Region and Language applet.
 
Back
Top