UserForm ComboBox Date Format

L

LSU_Richoux

I created a UserForm that utilizing a ComboBox that you can select
specific range of dates.

I would like the format of the date to show up like S.07 for a date of
09/07/2009. When I run the program and you click the down arrow of the
ComboBox input, the dates are in the right format. When you select a
date from the ComboBox drop down list, the format changes from S.07 to
September9.12 inside the ComboBox input and the output cell to the
spreadsheet also gets that September9.12 format.

Here is a sample of the code I have for both the UserForm and ComboBox

Private Sub UserForm_Click()
UserForm.Value = Format(UserForm.Value, "mmmmm.dd")
End Sub


Private Sub NCAADateInput_Change()
NCAADateInput.Value = Format(NCAADateInput.Value, "mmmmm.dd")
Worksheets("Main").Range("O1").Value = NCAADateInput.Value
End Sub

The custom mmmmm.dd format works just like I want inside the excel
spreadsheet when you format cells.

Any help would be greatly appreciated. Thanks in advance.
 
R

ryguy7272

Untested, but something like this, perhaps:
Private Sub ComboBox1_Change()
If ComboBox1.Value <> "" Then
ComboBox1.Value = Format(ComboBox1.Value, "dd/mm/yyyy")
End If
End Sub

HTH,
Ryan---
 

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