VBA copied date and paste in the reverse order

AlexPeteson

New Member
Joined
Feb 19, 2019
Messages
2
Hi Community

The following is an extract of my code. Basically, I'm copying rows of data from source workbooks to a mastercopy workbook.
All fields copied over are fine except for the date files. It went from 07/03/2019 (Source) to 03/07/2019 (Mastercopy).
Is there a value that i can fix this date? Paste special maybe? How can i edit the code based on the below string?
Any advice is greatly appreciated, thanks!

erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range(Cells(erow, 2), Cells(erow, 10))

Regards
Peteson
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I assume you want dd/mm/yyyy
- you are making me guess because both 03 and 07 are less than 12 !!
- but I think you are referring to 7 March 2019 ???

Is this a simple formatting problem?
- add this line below ActiveSheet.Paste.... and amend the column to the one containing the dates
Code:
ActiveSheet.Columns("B").NumberFormat = "[COLOR=#ff0000]dd/mm/yyyy[/COLOR]"

It may not be a formatting problem
If above does not resolve the problem, look at the source data
Format the cell in the source 07/03/2019 as a NUMBER
if it changes to 43531 that is 7 March 2019
if it changes to 43649 that is 3 July 2019
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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