Date Problem

S

Subs

Hi All

I have a problem with the dates, I have a userform with two textboxes which
have a date in them by default. i.e. (English Short Date) 23/03/05, I also
have a number of buttons where the user can click and can change (increment)
any part of the date i.e. the Day the month or the year.

However when I use the buttons I get strange results the year changes into
4 digits and the date changes to the American Date Format.

When this happens, I go into regional and language settings and then
regional options, customise and reset the settings. save it and the userform
works fine .
But when I close it and reopen it it reverts back to the American Format.

Can anyone help me with this

Knd Regards

Subs
 
D

David McRitchie

Hi aliased "Subs",
Excel will use the short date format from your Regional Settings.
VBA will use the US date format.

You need to use Dateserial in VBA the same way
that you might use the DATE Worksheet Function in Excel
in a date calculation formula to make sure that you enter
a calculated date properly when you might otherwise have
a problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top