Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm ComboBox Date Format
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Format Date ComboBox | Excel Discussion (Misc queries) | |||
format of combobox on userform | Excel Programming | |||
format combobox in userform to accept dates | Excel Worksheet Functions | |||
Userform: Combobox, dates, match required- can't get date format to work | Excel Programming | |||
Userform Combobox to choose date | Excel Programming |