Problem with Userform 'Calendar to textbook' Date Format

TitusandNero

New Member
Joined
Mar 17, 2016
Messages
26
Hello there,
Can someone help me please? I'm operating on Excel 2007 and using Calendar Control 11.0. I have textbox (tbDJ1) on a userform (CaseManagementSystem) and next to it is a command button. Click on the command button and it shows a calendar on a separate userform (Calendar), click on a date and it populates the text box. However, the format of the date when it populates the textbook is mm/dd/yy and I need it in dd/mm/yy. Is there a way to change this? Here is my code which is on the Calendar userform:

Private Sub Calendar1_Click()
CaseManagementSystem.tbDJ1 = Calendar1.Value
End Sub

Any help would be much appreciated. Thank you.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hello TitusandNero,

Try this...
Code:
Private Sub Calendar1_Click()
     CaseManagementSystem.tbDJ1 = Format(Calendar1.Value, "short date")
End Sub
 
Upvote 0
Hi Leith - thank you but unfortunately it doesn't seem to like the comma after Value. Turns red and returns a pop up saying 'Compile Error: Expected: end of statement'
 
Upvote 0
DUH!! I take that back - I left out the FORMAT bit - Superb! It works perfectly. Thank you so much it was driving me bonkers.
 
Upvote 0
Hello TitusandNero,

When that happens to me, i either drink more coffee or try to get more sleep. That usually fixes the problem.

Glad you got it working.
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,986
Members
448,538
Latest member
alex78

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