show data into multiple textbox from filled listbox based on search textbox and highlight into listbox

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,429
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
hello
i have data when show userform show all of data into list box i'm asking if is possible when i search data in textbox1 then show directly the data in multiple textbox and highlight by blue in listbox as my picture without i select this from listbox
gg.jpg
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
show directly the data in multiple textbox
assuming textboxes go from 2 to 10, try this

VBA Code:
Private Sub TextBox1_Change()
  Dim i As Long, j As Long
  
  With ListBox1
    For j = 2 To 10
      Controls("TextBox" & j) = ""
    Next
    .ListIndex = -1
    If TextBox1 = "" Then Exit Sub
    For i = 1 To .ListCount - 1
      If LCase(.List(i, 1)) = LCase(TextBox1) Then
        .Selected(i) = True
        For j = 2 To 10
          Controls("TextBox" & j) = .List(i, j - 2)
        Next
        Exit For
      End If
    Next
  End With
End Sub
 
Upvote 0
hi, dante i tested your code nothing happens any thing no show data from textbox2 to 10
 
Upvote 0
In textbox1 you must write a data.
According to your example, if you write the data asd14 in textbox1, the other textboxes are filled.
The data you write in textbox1 should be in the second column of listbox1.
 
Upvote 0
sorry dante about delaying respond you actually the internet is very weak about your code i wrote in textbox1 not happens any thing i no know where is a problem
 
Upvote 0
Do you have a textbox called Texbox1?
The code did you put inside the userform?
I repeat:
According to your example, if you write the data asd14 in textbox1, the other textboxes are filled.

You can do the test with the data you put in your image.
That is, fill the listbox with the data that you put as an example in your image.
After you fill the listbox1 with the data from your example of your image, write the data asd14 in your textbox1.
 
Upvote 0
about your questions are yes so i have to upload my file to find out something
this is my file
CUS.xlsm
 
Upvote 0
What about this:
The code did you put inside the userform?
I repeat:
According to your example, if you write the data asd14 in textbox1, the other textboxes are filled.

You can do the test with the data you put in your image.
That is, fill the listbox with the data that you put as an example in your image.
After you fill the listbox1 with the data from your example of your image, write the data asd14 in your textbox1.
 
Upvote 0
You have another code that deletes everything my code does.
Delete this code


Rich (BB code):
Private Sub TextBox10_Change()
Dim i As Long, j As Long

  With ListBox1
    For j = 1 To 9
      Controls("TextBox" & j) = ""
    Next
    .ListIndex = -1
    If TextBox10 = "" Then Exit Sub
    For i = 1 To .ListCount - 1
      If LCase(.List(i, 1)) = LCase(TextBox10) Then
        .Selected(i) = True
        For j = 2 To 10
          Controls("TextBox" & j) = .List(i, j - 2)
        Next
        Exit For
      End If
    Next
  End With
End Sub
 
Upvote 0
Solution
hi, dante it doesn't work the first row in list box asd12 it ' works for the rest data asd15,13...so on
 
Upvote 0

Forum statistics

Threads
1,215,521
Messages
6,125,305
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top