ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date problem from code to text box to spreadsheet (https://www.excelbanter.com/excel-programming/280085-date-problem-code-text-box-spreadsheet.html)

Joe 90[_2_]

Date problem from code to text box to spreadsheet
 
I have a textbox on a userform in which I set the date with code -
format(date,"dd-mm-yy")

This looks fine on the form.

The value of the textbox is then passed to a spreadsheet cell,which is
preformatted with the same date format.

However 10-12-03 (10th December) comes out on the spreadsheet as 12-10-03
(12th October)

to fix this I have recorded as format(date,"mm-dd-yy"), which works but this
is not right surely.

All regional settings are UK English .

Any suggestions?


Media Lint

Date problem from code to text box to spreadsheet
 
I suspect it is getting transposed when you pass the
argument.

Stop testing with that date ... use something which can
ONLY work one way: October 31, for example. That way
you'll be able to easier track down the real problem since
you should get an ERROR where it fails.


-----Original Message-----
I have a textbox on a userform in which I set the date

with code -
format(date,"dd-mm-yy")

This looks fine on the form.

The value of the textbox is then passed to a spreadsheet

cell,which is
preformatted with the same date format.

However 10-12-03 (10th December) comes out on the

spreadsheet as 12-10-03
(12th October)

to fix this I have recorded as format(date,"mm-dd-yy"),

which works but this
is not right surely.

All regional settings are UK English .

Any suggestions?

.


Harald Staff

Date problem from code to text box to spreadsheet
 
How is it passed ?
Sheets(2).Cells(14, 3).Value = Datevalue(Textbox1.Text)
should interprete according to your regional preferences.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Joe 90" (remove silly spam) wrote in message
...
I have a textbox on a userform in which I set the date with code -
format(date,"dd-mm-yy")

This looks fine on the form.

The value of the textbox is then passed to a spreadsheet cell,which is
preformatted with the same date format.

However 10-12-03 (10th December) comes out on the spreadsheet as 12-10-03
(12th October)

to fix this I have recorded as format(date,"mm-dd-yy"), which works but this
is not right surely.

All regional settings are UK English .

Any suggestions?





All times are GMT +1. The time now is 12:18 AM.

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