ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dates (https://www.excelbanter.com/excel-programming/326880-dates.html)

Jason Zischke

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?

Dave Peterson[_5_]

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

Jason Zischke

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


Dave Peterson[_5_]

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

Ron Rosenfeld

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

Tom Ogilvy

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





All times are GMT +1. The time now is 11:14 PM.

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