Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Mar 23, 3:31*pm, "abu "
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Verify Canadian Postal Code ~ make the code work | Excel Programming | |||
make code less lines | Excel Programming | |||
How do I make a Bar code ??? | Excel Discussion (Misc queries) | |||
How to make a button VBA code reference other VBA code subroutines??? | Excel Programming | |||
How to make VBA code to self-destroy itself? | Excel Programming |