Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
digicat
 
Posts: n/a
Default date changes mysteriously when copied


I use a macro to copy the date from the input form (on sheet1) to the
table on sheet2 with this code:

Dim Row As Integer
Row = 3
Do While Worksheets("SHEET2").Cells(Row, "A") < ""
Row = Row + 1
Loop
Worksheets("SHEET2").Cells(Rij, "B") =
Worksheets("SHEET1").Range("C3")
--more code follows to copy the other cells form the input form to the
table--

Mysteriously the date changes when copied to sheet2:
e.g. 20-02-2006 becomes 21-02-2010.
Exactly 4 years is added: 4 x 365 + 1 (leapday)
When I put format to "standard" the problem does not occur.

Can the reason be "Dim Rij As Integer"?
How do I solve the problem?


--
digicat
------------------------------------------------------------------------
digicat's Profile: http://www.excelforum.com/member.php...o&userid=14920
View this thread: http://www.excelforum.com/showthread...hreadid=514346

  #2   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default date changes mysteriously when copied

Hi
It sounds as though your sheet is set to use the 1904 date system.
ToolsOptionsCalculationuncheck 1904 date system

--
Regards

Roger Govier



digicat wrote:
I use a macro to copy the date from the input form (on sheet1) to the
table on sheet2 with this code:

Dim Row As Integer
Row = 3
Do While Worksheets("SHEET2").Cells(Row, "A") < ""
Row = Row + 1
Loop
Worksheets("SHEET2").Cells(Rij, "B") =
Worksheets("SHEET1").Range("C3")
--more code follows to copy the other cells form the input form to the
table--

Mysteriously the date changes when copied to sheet2:
e.g. 20-02-2006 becomes 21-02-2010.
Exactly 4 years is added: 4 x 365 + 1 (leapday)
When I put format to "standard" the problem does not occur.

Can the reason be "Dim Rij As Integer"?
How do I solve the problem?



  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default date changes mysteriously when copied

Just to add to Roger's response...

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.

digicat wrote:

I use a macro to copy the date from the input form (on sheet1) to the
table on sheet2 with this code:

Dim Row As Integer
Row = 3
Do While Worksheets("SHEET2").Cells(Row, "A") < ""
Row = Row + 1
Loop
Worksheets("SHEET2").Cells(Rij, "B") =
Worksheets("SHEET1").Range("C3")
--more code follows to copy the other cells form the input form to the
table--

Mysteriously the date changes when copied to sheet2:
e.g. 20-02-2006 becomes 21-02-2010.
Exactly 4 years is added: 4 x 365 + 1 (leapday)
When I put format to "standard" the problem does not occur.

Can the reason be "Dim Rij As Integer"?
How do I solve the problem?

--
digicat
------------------------------------------------------------------------
digicat's Profile: http://www.excelforum.com/member.php...o&userid=14920
View this thread: http://www.excelforum.com/showthread...hreadid=514346


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a schedule from a list of dates ? Gavin Morris Charts and Charting in Excel 2 October 28th 10 04:08 PM
Insert Automatic, Non-Updating Date Stamp Ken Zenachon Excel Discussion (Misc queries) 8 January 18th 06 06:52 PM
Adding XY days to date in cells satucha Excel Discussion (Misc queries) 1 November 25th 05 08:02 AM
Another Date issue. TimM Excel Worksheet Functions 1 November 17th 05 01:58 AM
Recurring annual events using a specific date as a trigger date Bamboozled Excel Worksheet Functions 1 June 6th 05 01:44 PM


All times are GMT +1. The time now is 12:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"