Results 1 to 2 of 2

Thread: Simple macro filter help

  1. #1
    Seeker Engineer22's Avatar
    Join Date
    Jun 2018
    Posts
    8
    Articles
    0
    Excel Version
    2007

    Post Simple macro filter help



    Register for a FREE account, and/
    or Log in to avoid these ads!

    I need to be able to search multiple data columns, as of right now i am just able to search 1. PLEASE HELP
    Attached Files Attached Files

  2. #2
    Conjurer Logit's Avatar
    Join Date
    Nov 2016
    Posts
    190
    Articles
    0
    Excel Version
    2007
    .
    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
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •