#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Dates

I Have a Problem with a Programme that I have created where when a button is
pressed it puts today's date into a cell however towards the start of every
month it mixes up the date for example 06-apr-05 will be entered as 04-jun-05
how can I stop this from Happening?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Dates

I'm betting you're trying to format the date in your code.

How about just putting the date in the cell, then format that cell:

with activesheet.range("a1")
.value = date
.numberformat="dd-mmm-yy"
end with

(Although, I like to use 4 digit years!)



Jason Zischke wrote:

I Have a Problem with a Programme that I have created where when a button is
pressed it puts today's date into a cell however towards the start of every
month it mixes up the date for example 06-apr-05 will be entered as 04-jun-05
how can I stop this from Happening?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Dates

Dave, This will not solve my problem because I've made sure the the cells
that get these dates have been properly formated to "dd-mmm-yy" however
thanks for your reply.

"Dave Peterson" wrote:

I'm betting you're trying to format the date in your code.

How about just putting the date in the cell, then format that cell:

with activesheet.range("a1")
.value = date
.numberformat="dd-mmm-yy"
end with

(Although, I like to use 4 digit years!)



Jason Zischke wrote:

I Have a Problem with a Programme that I have created where when a button is
pressed it puts today's date into a cell however towards the start of every
month it mixes up the date for example 06-apr-05 will be entered as 04-jun-05
how can I stop this from Happening?


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Dates

It sure sounds like excel is interpretting your value differently than you want.

If you remove that decision from excel by just assigning the date, you may find
it works better.

Did you try it?



Jason Zischke wrote:

Dave, This will not solve my problem because I've made sure the the cells
that get these dates have been properly formated to "dd-mmm-yy" however
thanks for your reply.

"Dave Peterson" wrote:

I'm betting you're trying to format the date in your code.

How about just putting the date in the cell, then format that cell:

with activesheet.range("a1")
.value = date
.numberformat="dd-mmm-yy"
end with

(Although, I like to use 4 digit years!)



Jason Zischke wrote:

I Have a Problem with a Programme that I have created where when a button is
pressed it puts today's date into a cell however towards the start of every
month it mixes up the date for example 06-apr-05 will be entered as 04-jun-05
how can I stop this from Happening?


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Dates

On Tue, 5 Apr 2005 18:33:02 -0700, "Jason Zischke"
wrote:

Dave, This will not solve my problem because I've made sure the the cells
that get these dates have been properly formated to "dd-mmm-yy" however
thanks for your reply.


Yes -- but how is your programming outputting the result. Unless the output is
a number, which Excel can then interpret as a date, formatting will have no
affect.


--ron


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dates

Formatting the cell has no effect on how VBA interprets the date when
placing a value in the cell.

Post your code and perhaps someone can show you how to remove the problem.

--
Regards,
Tom Ogilvy

"Jason Zischke" wrote in message
...
Dave, This will not solve my problem because I've made sure the the cells
that get these dates have been properly formated to "dd-mmm-yy" however
thanks for your reply.

"Dave Peterson" wrote:

I'm betting you're trying to format the date in your code.

How about just putting the date in the cell, then format that cell:

with activesheet.range("a1")
.value = date
.numberformat="dd-mmm-yy"
end with

(Although, I like to use 4 digit years!)



Jason Zischke wrote:

I Have a Problem with a Programme that I have created where when a

button is
pressed it puts today's date into a cell however towards the start of

every
month it mixes up the date for example 06-apr-05 will be entered as

04-jun-05
how can I stop this from Happening?


--

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
Linking computer dates (time) to spreadsheet dates that have formu bigisle Excel Worksheet Functions 3 January 3rd 10 08:05 PM
Stop dates from showing as numbers - when formated as dates JR Excel Discussion (Misc queries) 1 October 29th 08 04:38 PM
compare 2 tables of dates to find the preceding dates Babi Excel Worksheet Functions 3 October 28th 08 05:52 AM
Toggle a range of Julian dates to Gregorian Dates and Back PSKelligan Excel Programming 4 May 8th 07 05:51 AM
Charting data against dates where dates are not at fixed intervals PK Charts and Charting in Excel 4 June 16th 05 05:08 AM


All times are GMT +1. The time now is 08:37 PM.

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"