: I had made a user form with three combo box CboDay, CboMonth,
: CboYear in the initialize user form i had put this cord but i
: want that it is working fine but i want to reduce the coding and
: wanted that the value between 1 to 30 come in day . between 1 to
: 12 in month combobox etc
Create a sub routine which adds integers to an object. Then
call that sub for each object you are initializing.
Private Sub UserForm_Initialize()
' Initialize Combo Boxes
AddIntegerItems CboDay, 1, 31
AddIntegerItems CboMonth, 1, 12
AddIntegerItems CboYear, 2006, 2011
End Sub
' Assumes an object which supports AddItem method
Private Sub AddIntegerItems(object, iRangeLow, iRangeHigh)
Dim iInteger
For iInteger = iRangeLow To iRangeHigh
object.AddItem iInteger
Next iInteger
End Sub