changing the date format

nburton

New Member
Joined
Jul 28, 2016
Messages
2
I am working on a macro that at one point copies a date from sheet a to a sheet b. However, I need to change the date format from A to B. Currently sheet A has the format as yy-month, (in written form it looks like 16-May). I need it to be in mm/dd/yyyy when it copies to sheet B. I want the day to be "15". so for the example given 16-May would be pasted into sheet B as 05/15/2016. Is this possible? What I had previously reads the data as 5/16/16. Any help would be appreciated.

Code:
ddate = Cells(2, j).Value
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
If the date in sheet A is a true date (serial date number) you can use:

ddate = Format(Cells(2, j).Value,"mm/dd/yyyy")
 
Upvote 0

Forum statistics

Threads
1,222,902
Messages
6,168,938
Members
452,227
Latest member
sam1121

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