Banner

Thursday, February 9, 2017

Listbox Additem From Worksheet Between Two Date Excell VBA





Private Sub TextBox1_AfterUpdate()
On Error Resume Next
Me.TextBox1 = CDate(Me.TextBox1)
End Sub

Private Sub TextBox2_AfterUpdate()
On Error Resume Next
Me.TextBox2 = CDate(Me.TextBox2)
Me.ListBox1.Clear
For i = 2 To Application.WorksheetFunction.CountA(Sheet1.Range("A:A"))
If Sheet1.Cells(i, 1).Value >= CDate(Me.TextBox1.Value) And _
Sheet1.Cells(i, 1).Value <= CDate(Me.TextBox2.Value) Then
Me.ListBox1.AddItem Sheet1.Cells(i, 1).Value
Me.ListBox1.List(ListBox1.ListCount - 1, 1) = Sheet1.Cells(i, 2).Value & ".00"
End If
Next i
End Sub

No comments:

Post a Comment

Please do not enter any spam message in comment box