my userform contain
TB1 = START DATE
TB1 = END DATE
TB3 = COMBOBOX CONTAIN PARTY NAME
when search button click then data show in listbox between two date of party
macro is
>>> use code - tags <<<
but nothing is show
what is wrong in this code please correct the code and also attche the file
TB1 = START DATE
TB1 = END DATE
TB3 = COMBOBOX CONTAIN PARTY NAME
when search button click then data show in listbox between two date of party
macro is
>>> use code - tags <<<
Code:
Sub Search_Data()
On Error Resume Next
Dim lastrow As Long
Dim i As Long
With Account_Data_Search
Call Module1.Listbox_Format
lastrow = Sheets("Account_Data").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
If Sheets("Account_Data").Cells(i, 2).Value >= CDate(.TB1.Value) And Sheets("Account_Data").Cells(i, 2).Value <= CDate(.TB2.Value) And Sheets("Account_Data").Cells(i, 1).Value = .TB3.Text Then
.ListBox1.AddItem
.ListBox1.List(ListBox1.ListCount - 1, 0) = Sheets("Account_Data").Cells(i, 1).Value ' PARTY NAME
.ListBox1.List(ListBox1.ListCount - 1, 1) = Sheets("Account_Data").Cells(i, 2).Value ' DATE
.ListBox1.List(ListBox1.ListCount - 1, 2) = Sheets("Account_Data").Cells(i, 3).Value ' DOC NO
.ListBox1.List(ListBox1.ListCount - 1, 3) = Sheets("Account_Data").Cells(i, 4).Value ' DOC TYPE
.ListBox1.List(ListBox1.ListCount - 1, 4) = Sheets("Account_Data").Cells(i, 5).Value ' WEIGHT
.ListBox1.List(ListBox1.ListCount - 1, 5) = Sheets("Account_Data").Cells(i, 6).Value ' CENTER NAME
.ListBox1.List(ListBox1.ListCount - 1, 6) = Sheets("Account_Data").Cells(i, 7).Value ' RECEIVER
End If
Next i
End With
End Sub
but nothing is show
what is wrong in this code please correct the code and also attche the file
Attachments
Last edited by a moderator: