Simple macro filter help

Engineer22

New member
Joined
Jun 14, 2018
Messages
8
Reaction score
0
Points
0
Excel Version(s)
2007
I need to be able to search multiple data columns, as of right now i am just able to search 1. PLEASE HELP
 

Attachments

  • SEARCH BAR help.xlsm
    304.7 KB · Views: 8
.
Code:
Option Explicit


Sub FindInLists()
     '
     ' Select FindInLists Macro
     '
     
    Dim SheetsToSearch, SrchStrg As String, ws As Excel.Worksheet, r As Range
    SheetsToSearch = Array("Sheet1") '// Enter the exact sheet names of sheets to be searched
     
    SrchStrg = Application.InputBox("Enter Term to search ", "Search Term", Type:=2)
     
    For Each ws In ThisWorkbook.Sheets
        If Not IsError(Application.Match(ws.Name, SheetsToSearch, 0)) Then
            With ws.Range("A6:P6067")  'EDIT RANGE AS REQUIRED
                Set r = .Find(what:=SrchStrg, After:=.Range("A1"))   'find the cell whose value is equal to SrchStrg and activate it
                If Not r Is Nothing Then
                    ws.Activate: r.Activate
                    
                'PUT YOUR CODE HERE TO WRITE THE TICKER DATA SOMEWHERE FOR REVIEW
                    
                ElseIf r Is Nothing Then
                    MsgBox "Search term does not exist. ", vbInformation, "Item Not Found"
                End If
            End With
        End If
    Next
     
End Sub
 

Attachments

  • SEARCH BAR help.xlsm
    308.7 KB · Views: 11
Back
Top