I found it, I'm in USA where we use m-d-yyyy
Sub fill_ufCal_dnum() 'Also see Sub UserForm_Initialize() Dim c As Long Dim D As Long Dim MyDate As Date MyDate = CDate(ufCal.uMonth.Caption & "-1-" & ufCal.uYear.Caption) ' was - MyDate = CDate("1-" & ufCal.uMonth.Caption & "-" & ufCal.uYear.Caption) 'D = zero reference of Days of month D = FirstWeekDayOfMonth(MyDate) - 1 'clear captions 'Hint: Set Captions to "" In design mode instead. For c = 1 To 42 Me.Controls("dnum" & c).Caption = "" Next c 'Set Captions For c = 1 To DaysInMonth(MyDate) ' myDate Me.Controls("dnum" & D + c).Caption = c Next c End Sub




Reply With Quote