Date Format Macro

petes

Board Regular
Joined
Sep 12, 2009
Messages
168
Friends -

I need a macro that will display the curret date in message box in the belwo format:

09_03_2014


Thanks a lot!!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
You could use:
Code:
Sub ShowDate()
msgbox format(date, "mm_dd_yyyy")
end sub
 
Upvote 0
If your regional settings are US, see post #4.

PS This being an Excel board, people will assume you want VBA since VBS has nothing to do with Excel. ;)
 
Upvote 0
You said that today() was not a vba method. My bad. But it is an excel function. So just call that function into a variable and split it.
Today = application.worksheetfunction.today()

Or use this...
Today = Format(Date.Now(), "mm/dd/yyyy")

Then the rest of the code...
var = split(Today,"/")
Output = var(0) & "_" & var(1) & "_" & var(2)
Msgbox Output
 
Last edited:
Upvote 0

Forum statistics

Threads
1,222,150
Messages
6,164,242
Members
451,882
Latest member
Bigtop

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