Hello everyone.
I have an issue I really can't get my head around. I have a Sheet called "Crediteuren" with all creditors of my company, containing the following information:
Col A: Name creditor
Col B: Number creditor
Col C: Category
Col D: Contact person
Col E: E mail address
Col F: Telephone number
Col G: Quick look-up
There are three different, predefined, categories "Lab", "IT" and "A&R".
I have created a UserForm that finds the category in Column C, using the following code:
What this code does (obviously) is displaying a MsgBox for each time the set category in ComboBox2 is found.
Which is awesome of course, but What I would like is one MsgBox with a list of the Creditors that match the category String I am looking for. This MsgBox would look like:
Does anybody has to solution to this problem?
I have an issue I really can't get my head around. I have a Sheet called "Crediteuren" with all creditors of my company, containing the following information:
Col A: Name creditor
Col B: Number creditor
Col C: Category
Col D: Contact person
Col E: E mail address
Col F: Telephone number
Col G: Quick look-up
There are three different, predefined, categories "Lab", "IT" and "A&R".
I have created a UserForm that finds the category in Column C, using the following code:
Code:
Private Sub CommandButton4_Click()
Dim cat As String
Dim lastrow As Integer
Dim i As Integer
cat = ComboBox2.Value
rng = Sheets("Crediteuren").Range("A1000").Text
lastrow = Sheets("Crediteuren").Range("A1000").End(xlUp).Row
'i = 2 meams that the loop starts looking from row 2 To lastrow.
For i = 2 To lastrow
If Cells(i, 3) = cat Then
MsgBox "Found", vbOKOnly
End If
Next i
Unload Me
End Sub
What this code does (obviously) is displaying a MsgBox for each time the set category in ComboBox2 is found.
Which is awesome of course, but What I would like is one MsgBox with a list of the Creditors that match the category String I am looking for. This MsgBox would look like:
The following creditors match the criteria:
'Hit 1' Col A & Col B
'Hit 2' Col A & Col B
etc. etc.
Does anybody has to solution to this problem?