Banner

Saturday, March 4, 2017

Listbox Find Paid Invoice And Outstanding Invoice Userform Excell VBA





Private Sub OptionButton1_Click()

Me.ListBox1.Clear

Me.ListBox1.AddItem "Date"

Me.ListBox1.List(ListBox1.ListCount - 1, 1) = "Customer Name"

Me.ListBox1.List(ListBox1.ListCount - 1, 2) = "Invoice NO"

Me.ListBox1.List(ListBox1.ListCount - 1, 3) = "Amount"

Me.ListBox1.List(ListBox1.ListCount - 1, 4) = "Paid Amount"

Me.ListBox1.List(ListBox1.ListCount - 1, 5) = "Balance"

Me.ListBox1.Selected(0) = True

Dim i As Long

For i = 2 To Application.WorksheetFunction.CountA(Sheet1.Range("A:A"))

If Sheet1.Cells(i, "F").Value < 1 Then

Me.ListBox1.AddItem Sheet1.Cells(i, 1).Value

For a = 1 To 5

Me.ListBox1.List(ListBox1.ListCount - 1, a) = Sheet1.Cells(i, a + 1).Value

Next a

End If

Next i

End Sub

No comments:

Post a Comment

Please do not enter any spam message in comment box