ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Wrong dates in VBA (https://www.excelbanter.com/excel-programming/433677-wrong-dates-vba.html)

Oz Viking[_2_]

Wrong dates in VBA
 
I have columns with of dates. eg 1/07/2009 meaning 1 July 2009. When I copy
this date using VBA and paste it to another range, it changes to 7/01/2009
and produces incorrect reports ie as 7 January 2009. It is obviously a US
date thing but I don't know how to fix it.

Please help...

FSt1

Wrong dates in VBA
 
hi
i cannot duplicate your problem. i pre formated a cell to Norwegian(Bokmal)
and ran the following code.......
Range("B7").Copy Destination:=Range("B8")

and vb copied the date and format to the new cell meaning the date format
didnot change.

post the code you are using.

Regards
FSt1

"Oz Viking" wrote:

I have columns with of dates. eg 1/07/2009 meaning 1 July 2009. When I copy
this date using VBA and paste it to another range, it changes to 7/01/2009
and produces incorrect reports ie as 7 January 2009. It is obviously a US
date thing but I don't know how to fix it.

Please help...


Ron Rosenfeld

Wrong dates in VBA
 
On Tue, 15 Sep 2009 19:25:01 -0700, Oz Viking
wrote:

I have columns with of dates. eg 1/07/2009 meaning 1 July 2009. When I copy
this date using VBA and paste it to another range, it changes to 7/01/2009
and produces incorrect reports ie as 7 January 2009. It is obviously a US
date thing but I don't know how to fix it.

Please help...


You will need to post the code you are using, along with your Windows Regional
settings (from Control Panel).

Also, are the "dates" true Excel dates? or Text strings?

--ron

Dave Peterson

Wrong dates in VBA
 
Are you copy|pasting or assigning values?

If you're assigning values:

worksheets("Sheet999").range("A1").value2 _
= worksheets("sheet888").range("b2").value2



Oz Viking wrote:

I have columns with of dates. eg 1/07/2009 meaning 1 July 2009. When I copy
this date using VBA and paste it to another range, it changes to 7/01/2009
and produces incorrect reports ie as 7 January 2009. It is obviously a US
date thing but I don't know how to fix it.

Please help...


--

Dave Peterson


All times are GMT +1. The time now is 01:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com