Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default convert date 1900

I tried to force a date column to a text column by
inserting a tick before the date.
This works fine but if the date 01.01.1900
the result is '31.12.1899 .

the macro line is :
Dim cell As Range
...
cell = "'" & cell

what is wrong ?

thx for your help
rainer


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default convert date 1900

maybe you could use:

cell.value = "'" & cell.text



Rainer Welzel wrote:

I tried to force a date column to a text column by
inserting a tick before the date.
This works fine but if the date 01.01.1900
the result is '31.12.1899 .

the macro line is :
Dim cell As Range
..
cell = "'" & cell

what is wrong ?

thx for your help
rainer


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default convert date 1900

What is wrong is that Excel worksheet dates incorrectly (but intentionally)
treat 1900 as a leap year. It wasn't. On a worksheet, a cell containing the
number 1 is Jan 1, 1900; the number 60 is Feb 29, 1900.

But the error re 1900 not being a leap year is not present in VBA, and the
method used to make the correction was to simply make 60 represent Feb 28,
1900, 1 represent Dec 31, 1899, etc.

So your code will produce "errors" for all dates between Jan 1, 1900 and Feb
28, 1900. You'll could build in a check for that, or write your code this way:

Cell.Value = "'" & Cell.Text

On Fri, 25 Feb 2005 16:44:53 +0100, "Rainer Welzel"
wrote:

I tried to force a date column to a text column by
inserting a tick before the date.
This works fine but if the date 01.01.1900
the result is '31.12.1899 .

the macro line is :
Dim cell As Range
..
cell = "'" & cell

what is wrong ?

thx for your help
rainer


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
convert Excel sheet in 1904 format to 1900 without changing dates Joe Excel Worksheet Functions 1 June 8th 07 01:51 PM
Replace date 00.01.1900 Roar Excel Discussion (Misc queries) 4 January 3rd 07 01:52 PM
Date Conversion pre. 1900 SeeAll New Users to Excel 1 June 29th 06 10:58 PM
HAVE A COLUMN OF DATE PAYMENTS ARE DUE DATE CHANGES TO 01/00/1900 CK Excel Discussion (Misc queries) 3 July 7th 05 07:06 PM
Date format pre-1900. Craig & Co. Excel Discussion (Misc queries) 1 February 15th 05 05:09 AM


All times are GMT +1. The time now is 09:32 AM.

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

About Us

"It's about Microsoft Excel"