For Combobox & Textbox Private Sub UserForm_Initialize() Me.TextBox1.Value = Format(Date, "YYYY") For i = 0 To 11 a = Application.WorksheetFunction.EDate("1" & "/" & "January" & "/" & Me.TextBox1.Value, i) Me.ComboBox1.AddItem Format(a, "MMMM") Next i Me.ComboBox1.Value = Format(Date, "MMMM") End Sub Private Sub TextBox1_Change() Call ComboBox1_Change End Sub For Spinbutton Private Sub SpinButton1_SpinDown() On Error Resume Next Me.TextBox1.Value = Me.TextBox1.Value - 1 End Sub Private Sub SpinButton1_SpinUp() On Error Resume Next Me.TextBox1.Value = Me.TextBox1.Value + 1 End Sub For Listbox Private Sub ComboBox1_Change() Me.ListBox1.Clear For i = 1 To 31 On Error Resume Next Me.ListBox1.AddItem CDate(i & "/" & Me.ComboBox1.Value & "/" & Me.TextBox1.Value) Me.ListBox1.List(ListBox1.ListCount - 1, 1) = Format(CDate(i & "/" & _ Me.ComboBox1.Value & "/" & Me.TextBox1.Value), "DDDD") Next i End Sub |
Tuesday, February 7, 2017
Calendar In Excell VBA Useerform
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Please do not enter any spam message in comment box