From: abu abdullah........halsaeed85 on 23 Mar 2010 08:31 i have form to search for data through text box change code efect on listbox its working ok with this code Private Sub TextBox1_Change() On Error Resume Next Dim KH_Range As Range Dim M As String Set KH_Range = Range("DATA") M = TextBox1.Text ListBox1.Clear If M = "" Then GoTo 1 W = ListBox1.ListCount With KH_Range KH_1 = .Rows.Count KH_2 = .Columns.Count Set A = Range(.Cells(1, 1), .Cells(.Rows.Count, .Columns.Count)).FIND(M) If Not A Is Nothing Then F = A.Address Do ListBox1.AddItem ListBox1.List(W, 0) = Sheet3.Cells(A.Row, 1).Value ListBox1.List(W, 1) = Sheet3.Cells(A.Row, 2).Value ListBox1.List(W, 2) = Sheet3.Cells(A.Row, 3).Value ListBox1.List(W, 3) = Sheet3.Cells(A.Row, 4).Value ListBox1.List(W, 4) = Sheet3.Cells(A.Row, 5).Value ListBox1.List(W, 5) = Sheet3.Cells(A.Row, 6).Value W = W + 1 Set A = Range(.Cells(1, 1), .Cells(KH_1, KH_2)).FindNext(A) Loop While Not A Is Nothing And A.Address <> F End If End With Set A = Nothing 1 End Sub i want to hilight first row in list box contain data match textbox text when change it can any one help . thanks advanced
From: abu abdullah........halsaeed85 on 24 Mar 2010 04:38 On Mar 23, 3:31 pm, "abu abdullah........halsaee...(a)gmail.com" <halsaee...(a)gmail.com> wrote: > i have form to search for data through text box change code efect on > listbox its working ok with this code > Private Sub TextBox1_Change() > On Error Resume Next > Dim KH_Range As Range > Dim M As String > Set KH_Range = Range("DATA") > M = TextBox1.Text > ListBox1.Clear > If M = "" Then GoTo 1 > W = ListBox1.ListCount > With KH_Range > KH_1 = .Rows.Count > KH_2 = .Columns.Count > Set A = Range(.Cells(1, > 1), .Cells(.Rows.Count, .Columns.Count)).FIND(M) > If Not A Is Nothing Then > F = A.Address > Do > > ListBox1.AddItem > ListBox1.List(W, 0) = Sheet3.Cells(A.Row, 1).Value > ListBox1.List(W, 1) = Sheet3.Cells(A.Row, 2).Value > ListBox1.List(W, 2) = Sheet3.Cells(A.Row, 3).Value > ListBox1.List(W, 3) = Sheet3.Cells(A.Row, 4).Value > ListBox1.List(W, 4) = Sheet3.Cells(A.Row, 5).Value > ListBox1.List(W, 5) = Sheet3.Cells(A.Row, 6).Value > > W = W + 1 > > Set A = Range(.Cells(1, 1), .Cells(KH_1, KH_2)).FindNext(A) > Loop While Not A Is Nothing And A.Address <> F > End If > End With > Set A = Nothing > 1 End Sub > > i want to hilight first row in list box contain data match textbox > text when change it > can any one help . > thanks advanced up pls any help its urgent
|
Pages: 1 Prev: Advanced filter VS formula in cell Next: Type mismatch: array or user-defined type expected |