View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default UserForm ComboBox Date Format

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---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"LSU_Richoux" wrote:

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.