locked
Triple Search RRS feed

  • Question

  • Hi 

    i wanna to search data from sheet with 3 conditions   (my conditions are  textbox.value and ComboBox )

    and list box show me below column's

    If all three conditions was true
    or only one of them was true

    TH | Stk-no | Date | QTY | Price | company | Total | Info 

     as attached file :

    " i change the link and File "

    http://s1.picofile.com/file/7564768488/Triple_Search.xlsm.html 


    Saturday, November 24, 2012 8:07 AM

Answers

  • I have uploaded a working version of the workbook, with some random data, to SkyDrive: see http://sdrv.ms/ShW9LC

    Regards, Hans Vogelaar

    • Marked as answer by Mahdi Hassani Saturday, November 24, 2012 11:05 PM
    Saturday, November 24, 2012 10:59 PM

All replies

  • Please Help ME 
    Saturday, November 24, 2012 9:32 PM
  • Set the ColumnCount property of ListBox1 to 8. You may want to change the ColumnWidths property.

    Double-click the command button on the userform (in the Visual Basic Editor), and make the On Click event procedure look like this:

    Private Sub CommandButton1_Click()
        Dim r As Long
        Dim m As Long
        Dim n As Long
        m = Range("G" & Rows.Count).End(xlUp).Row
        Me.ListBox1.Clear
        For r = 2 To m
            If Range("G" & r) = CDate(Me.TextBox1) And Range("J" & r) = Me.ComboBox1 And _
                    Range("L" & r) = Me.TextBox3 Then
                Me.ListBox1.AddItem Range("B" & r)
                n = Me.ListBox1.ListCount - 1
                Me.ListBox1.Column(1, n) = Range("D" & r)
                Me.ListBox1.Column(2, n) = Range("G" & r)
                Me.ListBox1.Column(3, n) = Range("H" & r)
                Me.ListBox1.Column(4, n) = Range("I" & r)
                Me.ListBox1.Column(5, n) = Range("J" & r)
                Me.ListBox1.Column(6, n) = Range("K" & r)
                Me.ListBox1.Column(7, n) = Range("L" & r)
            End If
        Next r
    End Sub


    Regards, Hans Vogelaar

    Saturday, November 24, 2012 10:16 PM
  • hi Hans 

    Thanks for your help

    .....

    I've done it
    but nothing did
    and the error was encountered

    on the other hand

    i wanna

    If all three conditions was true
    or only one of them was true

    show me below column's


    TH | Stk-no | Date | QTY | Price | company | Total | Info 

    Best Regards, Mahdi Hassani

    Saturday, November 24, 2012 10:33 PM
  • What was the error message?

    Regards, Hans Vogelaar

    Saturday, November 24, 2012 10:37 PM
  • When I enter any of the three conditions
    Nothing's happening.

    and  when 

    i only enter Textbox3  the error  encountered 

    ""

    If Range("G" & r) = CDate(Me.TextBox1) And Range("J" & r) = Me.TextBox2 And _
                    Range("L" & r) = Me.TextBox3 Then

    ""

    Best Regards, Mahdi Hassani

    Saturday, November 24, 2012 10:44 PM
  • I have uploaded a working version of the workbook, with some random data, to SkyDrive: see http://sdrv.ms/ShW9LC

    Regards, Hans Vogelaar

    • Marked as answer by Mahdi Hassani Saturday, November 24, 2012 11:05 PM
    Saturday, November 24, 2012 10:59 PM
  • Extremely grateful 

    Best Regards, Mahdi Hassani

    Saturday, November 24, 2012 11:06 PM