Results 1 to 7 of 7

Thread: Search for all instances of a string then hide all other rows

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Newbie
    Joined
    Feb 2012
    Posts
    4
    Location
    Actually I was able to write a code using autofilters BUT I can only search one column and I need to search 2 (both colA and colB):

    [VBA]
    Sub Search()
    'written by jessmall
    Dim r As Range, filt As Range, j As Long, k As Long

    'Set r = Range("A5").CurrentRegion
    Dim MyData As String

    MyData = InputBox("Search by Format:xyz")
    If MyData = "" Then Exit Sub
    ' search all sheets in workbook

    Set r = Range("A5").CurrentRegion


    r.AutoFilter field:=1, Criteria1:=MyData & "*"

    End Sub
    [/VBA]
    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
  •