دو تا مشکل ، یکی اینکه کمبو باکس هم عدد هست هم حروف ، یعنی شامل کد پرسنلی ، کد ملی که عددن ، و نام و نام خانوادگی که حروف هستن
دوم اینکه با دستور match بازم ارور داره
دوم اینکه با دستور match بازم ارور داره
Private Sub CommandButton1_Click() Dim C As Range ListBox1.Clear If ComboBox1.ListIndex = -1 Then ComboBox1.ListIndex = 1 col = Application.WorksheetFunction.Match(ComboBox1.Value, Sheet1.Range("A1:G1"), 0) - 1 For Each C In Sheet1.Range("a3:a10000") If C.Value <> "" Then If C.Offset(0, col).Value Like "*" & TextBox1.Text & "*" Then If ComboBox4 <> "" Then If C.Offset(0, 8).Value >= ComboBox4.Text And C.Offset(0, 8).Value <= ComboBox5.Text Then ListBox1.AddItem 1 ListBox1.List(ListBox1.ListCount - 1, 0) = C.Offset(0, 0).Value ListBox1.List(ListBox1.ListCount - 1, 1) = C.Offset(0, 1).Value ListBox1.List(ListBox1.ListCount - 1, 2) = C.Offset(0, 2).Value ListBox1.List(ListBox1.ListCount - 1, 3) = C.Offset(0, 3).Value ListBox1.List(ListBox1.ListCount - 1, 4) = C.Offset(0, 4).Value ListBox1.List(ListBox1.ListCount - 1, 5) = C.Offset(0, 5).Value ListBox1.List(ListBox1.ListCount - 1, 6) = C.Offset(0, 6).Value ListBox1.List(ListBox1.ListCount - 1, 7) = C.Offset(0, 7).Value ListBox1.List(ListBox1.ListCount - 1, 8) = C.Offset(0, 8).Value ListBox1.List(ListBox1.ListCount - 1, 9) = C.Offset(0, 9).Value End If Else ListBox1.AddItem 1 ListBox1.List(ListBox1.ListCount - 1, 0) = C.Offset(0, 0).Value ListBox1.List(ListBox1.ListCount - 1, 1) = C.Offset(0, 1).Value ListBox1.List(ListBox1.ListCount - 1, 2) = C.Offset(0, 2).Value ListBox1.List(ListBox1.ListCount - 1, 3) = C.Offset(0, 3).Value ListBox1.List(ListBox1.ListCount - 1, 4) = C.Offset(0, 4).Value ListBox1.List(ListBox1.ListCount - 1, 5) = C.Offset(0, 5).Value ListBox1.List(ListBox1.ListCount - 1, 6) = C.Offset(0, 6).Value ListBox1.List(ListBox1.ListCount - 1, 7) = C.Offset(0, 7).Value ListBox1.List(ListBox1.ListCount - 1, 8) = C.Offset(0, 8).Value ListBox1.List(ListBox1.ListCount - 1, 9) = C.Offset(0, 9).Value End If End If End If Next End Sub
کامنت