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.
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Leith Ross

Well-known Member
Joined
Mar 17, 2008
Messages
1,874
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
Hello TitusandNero,

Try this...
Code:
Private Sub Calendar1_Click()
     CaseManagementSystem.tbDJ1 = Format(Calendar1.Value, "short date")
End Sub
 

TitusandNero

New Member
Joined
Mar 17, 2016
Messages
26
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'
 

TitusandNero

New Member
Joined
Mar 17, 2016
Messages
26
DUH!! I take that back - I left out the FORMAT bit - Superb! It works perfectly. Thank you so much it was driving me bonkers.
 

Leith Ross

Well-known Member
Joined
Mar 17, 2008
Messages
1,874
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,600
Messages
5,597,114
Members
414,125
Latest member
iQQ

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
Top