ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Date changes when copied and pasted (https://www.excelbanter.com/excel-discussion-misc-queries/199444-date-changes-when-copied-pasted.html)

jc

Date changes when copied and pasted
 
I am having a problem where when copying rows that contains a date field into
another workbook, the date actually changes (usually by minus 4 years and 1
day eg 04/10/2008 becomes 03/10/2004). The first workbook is an export from
another program which we receive by email and is a csv file when received.
It then has a VBA macro run over it that deletes unwanted columns, rearranges
columns and formats some columns to text (not the date field) before pasting
into another workbook.

The problem is intermittent but seems to be dependent on what order the
workbooks are opened in. Otherwise can only be solved by either closing
Excel and starting again and sometimes only by restarting the computer. Can
anyone help!



Dave Peterson

Date changes when copied and pasted
 
Saved from a previous post:

One workbook was using a base year of 1900 and the other was using 1904.
(tools|options|calculation tab|1904 date system)

One way to add those four years back is to find an empty cell, put 1462 into
that cell.

Copy that cell.

Select your range that contains the dates. Edit|PasteSpecial|click Add (in the
operation box).

You may have to reformat the cell as a date (mine turned to a 5 digit number).
But it should work.

You may want to do it against a copy...just in case.

(I'm not sure which one you'll fix. You may want to edit|pastespecial|click
subtract.)

Most windows users use 1900 as the base date. Mac users (mostly??) use 1904 as
the base date.


JC wrote:

I am having a problem where when copying rows that contains a date field into
another workbook, the date actually changes (usually by minus 4 years and 1
day eg 04/10/2008 becomes 03/10/2004). The first workbook is an export from
another program which we receive by email and is a csv file when received.
It then has a VBA macro run over it that deletes unwanted columns, rearranges
columns and formats some columns to text (not the date field) before pasting
into another workbook.

The problem is intermittent but seems to be dependent on what order the
workbooks are opened in. Otherwise can only be solved by either closing
Excel and starting again and sometimes only by restarting the computer. Can
anyone help!


--

Dave Peterson

Peo Sjoblom

Date changes when copied and pasted
 
It might be a good idea to format the cell where the OP puts the 1462 as a
date as well,
that way there won't be a serial number as the result


--


Regards,


Peo Sjoblom



"Dave Peterson" wrote in message
...
Saved from a previous post:

One workbook was using a base year of 1900 and the other was using 1904.
(tools|options|calculation tab|1904 date system)

One way to add those four years back is to find an empty cell, put 1462
into
that cell.

Copy that cell.

Select your range that contains the dates. Edit|PasteSpecial|click Add
(in the
operation box).

You may have to reformat the cell as a date (mine turned to a 5 digit
number).
But it should work.

You may want to do it against a copy...just in case.

(I'm not sure which one you'll fix. You may want to
edit|pastespecial|click
subtract.)

Most windows users use 1900 as the base date. Mac users (mostly??) use
1904 as
the base date.


JC wrote:

I am having a problem where when copying rows that contains a date field
into
another workbook, the date actually changes (usually by minus 4 years and
1
day eg 04/10/2008 becomes 03/10/2004). The first workbook is an export
from
another program which we receive by email and is a csv file when
received.
It then has a VBA macro run over it that deletes unwanted columns,
rearranges
columns and formats some columns to text (not the date field) before
pasting
into another workbook.

The problem is intermittent but seems to be dependent on what order the
workbooks are opened in. Otherwise can only be solved by either closing
Excel and starting again and sometimes only by restarting the computer.
Can
anyone help!


--

Dave Peterson




Dave Peterson

Date changes when copied and pasted
 
Or paste special|Check add (or subtract) AND check Values


Peo Sjoblom wrote:

It might be a good idea to format the cell where the OP puts the 1462 as a
date as well,
that way there won't be a serial number as the result

--

Regards,

Peo Sjoblom

"Dave Peterson" wrote in message
...
Saved from a previous post:

One workbook was using a base year of 1900 and the other was using 1904.
(tools|options|calculation tab|1904 date system)

One way to add those four years back is to find an empty cell, put 1462
into
that cell.

Copy that cell.

Select your range that contains the dates. Edit|PasteSpecial|click Add
(in the
operation box).

You may have to reformat the cell as a date (mine turned to a 5 digit
number).
But it should work.

You may want to do it against a copy...just in case.

(I'm not sure which one you'll fix. You may want to
edit|pastespecial|click
subtract.)

Most windows users use 1900 as the base date. Mac users (mostly??) use
1904 as
the base date.


JC wrote:

I am having a problem where when copying rows that contains a date field
into
another workbook, the date actually changes (usually by minus 4 years and
1
day eg 04/10/2008 becomes 03/10/2004). The first workbook is an export
from
another program which we receive by email and is a csv file when
received.
It then has a VBA macro run over it that deletes unwanted columns,
rearranges
columns and formats some columns to text (not the date field) before
pasting
into another workbook.

The problem is intermittent but seems to be dependent on what order the
workbooks are opened in. Otherwise can only be solved by either closing
Excel and starting again and sometimes only by restarting the computer.
Can
anyone help!


--

Dave Peterson


--

Dave Peterson

jc

Date changes when copied and pasted
 
Thanks very much. That makes sense. I was aware of the PC/Mac difference
but it didn't register as a possible cause. Will try your solution and hope
all goes well.

"Dave Peterson" wrote:

Saved from a previous post:

One workbook was using a base year of 1900 and the other was using 1904.
(tools|options|calculation tab|1904 date system)

One way to add those four years back is to find an empty cell, put 1462 into
that cell.

Copy that cell.

Select your range that contains the dates. Edit|PasteSpecial|click Add (in the
operation box).

You may have to reformat the cell as a date (mine turned to a 5 digit number).
But it should work.

You may want to do it against a copy...just in case.

(I'm not sure which one you'll fix. You may want to edit|pastespecial|click
subtract.)

Most windows users use 1900 as the base date. Mac users (mostly??) use 1904 as
the base date.


JC wrote:

I am having a problem where when copying rows that contains a date field into
another workbook, the date actually changes (usually by minus 4 years and 1
day eg 04/10/2008 becomes 03/10/2004). The first workbook is an export from
another program which we receive by email and is a csv file when received.
It then has a VBA macro run over it that deletes unwanted columns, rearranges
columns and formats some columns to text (not the date field) before pasting
into another workbook.

The problem is intermittent but seems to be dependent on what order the
workbooks are opened in. Otherwise can only be solved by either closing
Excel and starting again and sometimes only by restarting the computer. Can
anyone help!


--

Dave Peterson



All times are GMT +1. The time now is 03:58 AM.

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