Date Format

AndrewKent

Well-known Member
Joined
Jul 26, 2006
Messages
889
Hi there,

I have an ActiveX TextBox and ListBox on a worksheet that I'm having a bit of an issue with.

One of the columns the ListBox looks at (and I have linked to the TextBox) is a date column. The data in the background is in UK format, 22/06/2011, however when I view this in the ListBox (and when I load the TextBox using VBA) it populates as 6/22/2011.

The second issue I have is that when I write back to this column from the TextBox (again using VBA), if I type in "22/06/2011" when it is added to the cell, it does not recognise this as a date.

Can anymore help me out here?

Andy
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi Andy,

The problem might be related to your regional settings. You can determine what your regional setting is for date with this statement:

Code:
MsgBox "The xlDateOrder value is " & Application.International(xlDateOrder)

The return value indicates:
0 = month-day-year
1 = day-month-year
2 = year-month-day

I don't have much experience with this issue, but I believe that VBA will use the regional settings unless you use some method to explicitly force it to use a different format.

This link explains a few of those methods.
http://www.mindspill.org/873

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,862
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top