Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Anne CFS
 
Posts: n/a
Default Date formatting problem

Hi there,

I've tried everything I can think of with this one - help!!

I'm reading dates from 2 cells, storing them in variables, comparing them
and then storing the resulting date in a different cell.

Code currently is:

If stStoredDate< stDate then
stStoredDate=stDate
Activecell.Offset(0,1).Value = stStoredDate
End If

My problem is stStoredDate = 04/09/05 (4 Sep 05 as I'm in the UK), stDate is
the same, but the value in the cell is 09/04/05 (9 Apr 05). Both cells have
identical formatting. If I change the formatting to 'general', stStoredDate=
38599, but the value in the cell is 38451.

I've defined the dates as variants (poor quality data coming in from source,
so errors appear if I define them as dates) and the original code used
variants. I thought I might improve the situation by using strings,
converting the incoming data by using cStr to give the variables in the above
code, but even this has failed. I'm still getting what looks like a change
of format, but is actually a change of number (Bizarre!)

My Regional Settings show short date as dd/MM/yy; I'm not using the 1904
system; the cell formats all show American settings mm/dd/yy, so I'm using a
custom setting of dd/mm/yy. This has been defined by the organisation where
I work, so is being widely used.

HELP!!

Thanks
Anne
  #2   Report Post  
bj
 
Posts: n/a
Default

try <format<cell<custom and enter dd/mm/yy

"Anne CFS" wrote:

Hi there,

I've tried everything I can think of with this one - help!!

I'm reading dates from 2 cells, storing them in variables, comparing them
and then storing the resulting date in a different cell.

Code currently is:

If stStoredDate< stDate then
stStoredDate=stDate
Activecell.Offset(0,1).Value = stStoredDate
End If

My problem is stStoredDate = 04/09/05 (4 Sep 05 as I'm in the UK), stDate is
the same, but the value in the cell is 09/04/05 (9 Apr 05). Both cells have
identical formatting. If I change the formatting to 'general', stStoredDate=
38599, but the value in the cell is 38451.

I've defined the dates as variants (poor quality data coming in from source,
so errors appear if I define them as dates) and the original code used
variants. I thought I might improve the situation by using strings,
converting the incoming data by using cStr to give the variables in the above
code, but even this has failed. I'm still getting what looks like a change
of format, but is actually a change of number (Bizarre!)

My Regional Settings show short date as dd/MM/yy; I'm not using the 1904
system; the cell formats all show American settings mm/dd/yy, so I'm using a
custom setting of dd/mm/yy. This has been defined by the organisation where
I work, so is being widely used.

HELP!!

Thanks
Anne

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
Conditional formatting problem Bryan Excel Discussion (Misc queries) 3 July 16th 05 01:29 PM
Problem With Date and Time Picker Control 6.0 Sunnous Excel Discussion (Misc queries) 1 May 27th 05 04:23 PM
How do I set a date range for conditional formatting in a macro? billo Excel Worksheet Functions 3 February 7th 05 06:19 PM
Despite formatting a column in Excel 2002 worksheet as Short Date. Pete Whalley Excel Discussion (Misc queries) 2 February 7th 05 06:17 PM
Cell / Date Formatting Question when result = -0- seve Excel Discussion (Misc queries) 3 January 17th 05 02:29 AM


All times are GMT +1. The time now is 07:18 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"