• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Data Show In Listbox Between Two Dates From Worksheet

delta

Member
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 <<<
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:

p45cal

Well-Known Member
The likes of:
Code:
.ListBox1.List(ListBox1.ListCount - 1, 2) =
is missing a dot:
Code:
.ListBox1.List(.ListBox1.ListCount - 1, 2) =
 
Top