quickone, date formats

rs2k

Well-known Member
Joined
Aug 15, 2004
Messages
1,413
I have a userform which has a text box for the date (the date comes from the calendar control) it is formatted as "dd/mm/yyyy" (UK format) when the data is transferred onto the WS it converts it to US format mm/dd/yyy. The worksheet is formatted as UK - "dd/mm/yyyy"

Can anyone explain why it is converting it, and more so, how to rectify it?

Many thanks

Colin.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Colin

How are you transferring the date?
 
Upvote 0
Hi Norie,
From the userform I have a cmdButton "Add to Bookings"

Private Sub cmdBookingsAddtoList_Click()
Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Bookings")
'find first empty row in database
irow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Range("A" & irow) = txtBookingsDate.Value
.Range("B" & irow) = cmbBookingsClients.Text
.Range("C" & irow) = cmbBookingsTimeFrom.Value
.Range("D" & irow) = cmbBookingsTimeTo.Value
txtBookingsDate = " "
cmbBookingsClients = " "
cmbBookingsTimeFrom = " "
cmbBookingsTimeTo = " "
End With

End Sub

The calendar has the following code;

Private Sub CalendarBookings_Click()
frmBookings.txtBookingsDate.Value = Format(CalendarBookings.Value, "dd/mm/yyyy")
Unload Me
End Sub


Cheers
Colin.
 
Upvote 0
Colin

Why not try using a true date value?

Does this help at all?
Code:
.Range("A" & irow) = DateValue(txtBookingsDate.Value)
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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