I have a UserForm which asks for a date with three separate ComboBox (month, day, year).
I have initialized them as follows:
Public Sub UserForm_Initialize()
' Add months to the ComboBox
With Month
For x = 1 To 12
.AddItem (x)
Next x
End With
' Add days to the combo box
With Day
For y = 1 To 31
.AddItem (y)
Next y
End With
' Add Years to the combo box
With Year
For y = 2010 To 2015
.AddItem (y)
Next y
End With
Shift.AddItem "Day" ' Add day shift
Shift.AddItem "Night" ' Add night shift
'Month.Value = Month(Date)
'Day.Value = Day(Date)
'Year.Value = Year(Date)
End Sub
What I am trying to do is pre-set them with the current date. I have attempted it with the commented out code at the bottom which gives an error "Type Mismatch"
Any ideas on how I can successfully pre-set them?
Thanks!
Also posted at: http://www.mrexcel.com/forum/showthr...15#post2382015
Bookmarks