How to search same name values in listbox

Status
Not open for further replies.

Harsh sharma

Banned - Rule violations
Joined
Aug 1, 2020
Messages
11
Office Version
  1. 2019
Platform
  1. Windows
Please help me.I have a userform in which i have to search data with date and customer name in text box1 and textbox2 then the data of same row loads on other textboxes but there is rows below the search data in column A there is date + customer name which i also have to search and show the data in listbox of there rows you can look at code below for example
First row is 20.02.20,harsh sharma ,1800 rs etc
Second rows which i want in listbox is 20.02.20Harsh sharma,vegetable name 1
20.02.20Harsh sharma, vegetable name 2
Again another customer name and date
First row is 21.02.20,naman sharma,200rs
Second rows which i want in listbox is
21.02.20naman sharma,vegetable name 1
21.02.20naman sharma,vegetable name 2


Dim x as long , y as long ,w as string
X= sheet6.cells("A").rows.count.xlup.end
Y = 3 to x
If me.textbox1.value = sheet6.cells(y,1).value and me.textbox2.value = sheet6.cells(y,2).value then
Me.textbox3.value = sheet6.cells(y,3).value
Me.textbox4.value = sheet6.cells(y,4).value
Me.textbox5.value = sheet6.cells(y,5).value
w = me.textbox1.value + me.textbox2.value
If w = sheet6.cells(y,1).value then
Me.Listbox1.additem sheet6.cells(y,3).value
End if
End if
Next y
End sub
Thanks in advance i need it very much whoever the person is reading may god bless you you don't know how much it can help mw
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Status
Not open for further replies.

Forum statistics

Threads
1,215,054
Messages
6,122,901
Members
449,097
Latest member
dbomb1414

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