Userform to search on two column from data range


New Member
Mar 30, 2017
At the moment, I am searching on one column. But I am stuck on how to search on two or multiple fields to bring up more of a specific result.
I am trying to narrow my search down from 1 to 2 to bring up more specific data. Can anyone help. Thanks in Advance. Appreciate the help!!!!!
<code>[Public CallDetails As Collection

Public Function Find_CallNumbers(NumberToFind As String) As Collection

Dim rng_to_search As Range
Dim rFound As Range
Dim FirstAddress As String
Dim FoundItem As clsCallDetails

Set CallDetails = New Collection

With ThisWorkbook.Worksheets("Database")
Set rng_to_search = .Range(.Cells(1, 1), .Cells(.Rows.Count, 1).End(xlUp))
End With

With rng_to_search
'Look for the first instance.
Set rFound = .Find(what:=NumberToFind, _
after:=.Cells(1, 1), _
LookIn:=xlValues, _
LookAt:=xlPart, _
If Not rFound Is Nothing Then
FirstAddress = rFound.Address
Set FoundItem = New clsCallDetails 'Create a new instance of the class to hold the details.
With FoundItem
.Title = rFound.Offset(, 7) 'CORRECT
.LoggedBy = rFound.Offset(, 2) 'CORRECT .Offset from column A by 1 column, so column B.
.CallNumber = rFound.Offset(, 3) 'CORRECT
.DateField = rFound.Offset(, 4) 'CORRECT
.OwnerField = rFound.Offset(, 6) 'CORRECT
.Description = rFound.Offset(, 8) 'CORRECT
.Solution = rFound.Offset(, 9) 'CORRECT
.URLImage = rFound.Offset(, 10) 'CORRECT
.DateResolved = rFound.Offset(, 5) 'CORRECT
.Reference = rFound.Offset(, 1) 'CORRECT

End With
CallDetails.Add FoundItem 'Add the class instance to our collection.
Set rFound = .FindNext(rFound) 'Look for the next value.

'Continue searching until we reach the top again.
Loop While Not rFound Is Nothing And rFound.Address <> FirstAddress
End If
End With

End Function]</code>

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...