I have a sheet full of data and it will be easier if i can search the data i need.
Like an SQL Query:
SELECT * FROM table_name WHERE Name='test'
So i found this script which partially works for my case.
Sub Zoek()
Dim erow As Long
Dim ws As Worksheet
Dim Lastrow As Long
Dim count As Integer
Dim resultrow As Integer
resultrow = 11
Lastrow = Sheets("Klanten").Cells(Rows.count, 1).End(xlUp).Row
count = 0
For x = 5 To Lastrow
If Sheets("Klanten").Cells(x, 2) = Sheet1.Range("C6") Then
Sheet1.Range("C11") = Sheets("Klanten").Cells(x, 1)
Sheet1.Range("B11") = Sheets("Klanten").Cells(x, 2)
Sheet1.Range("D11") = Sheets("Klanten").Cells(x, 11)
count = count + 1
End If
Next x
End Sub
The problem with this piece of code is that, when there are multiple occurrences of the same search query it will be overwritten and only the last hit of that search will show in the cells (B11, C11, D11).
How can i make so that every match will be shown in (B11 - Bxx, C11- Cxx, D11- Dxx) ?
I know this question probably has been asked before but the solution seems so advanced.
I am a total noob in VBA so i fail to figure out how to implement those solutions.
I would appreciate if someone could provide me a solution with this code.