MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Combo Boxes - Dates


Posted by Michelle Mifflin on February 13, 2002 8:41 PM

I'm having trouble with my combo box converting dates to numbers. My list and cell (under combo box) have been formatted as dates, however when I select the date it converts it to a number. V fustrating. Iam using a mmm-yy format.

Can anyone tell me what I'm overlooking????


Posted by lenze on February 14, 2002 6:46 AM

Add this code to the combo box

Private Sub ComboBox1_Change()
ComboBox1.Value = Format(ComboBox1.Value, "mmm-yy")
End Sub

Posted by Michelle Mifflin on February 14, 2002 2:00 PM

Private Sub ComboBox1_Change()
ComboBox1.Value = Format(ComboBox1.Value, "mmmm-yyyy")
ComboBox1.Font = Format(ComboBox1.Font, "ColorIndex = 3")
ComboBox1.Font.Bold = False
ComboBox1.Font.Bold = True
With ComboBox1.Font
.Name = "Arial"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With
End Sub

I would appreciate any "de-bugging" of my feeble attempts V.much.

MEM

:Add this code to the combo box

Posted by lenze on February 14, 2002 2:22 PM

Michelle:

You don't need the change macro to set the other properties. This can be done in the Properties Window. The font can be set to Bold, Arial, Size 14. Change the ForeColor property for the correct color.

HTH

Posted by Michelle Mifflin on February 14, 2002 8:05 PM

:L

:Thankyou v.much - didn't look at the forecolor in properties!

:Combo box looks v.neat now!

:MEM

Michelle: You don't need the change macro to set the other properties. This can be done in the Properties Window. The font can be set to Bold, Arial, Size 14. Change the ForeColor property for the correct color. HTH

Posted by Michelle Mifflin on February 14, 2002 8:27 PM

:L

:Thankyou very much - I had overlooked the "forecolour", combo box looks V.neat now.

:M :-)

Michelle: You don't need the change macro to set the other properties. This can be done in the Properties Window. The font can be set to Bold, Arial, Size 14. Change the ForeColor property for the correct color. HTH