+ Reply to Thread
Results 1 to 9 of 9

How to search for text across multiple worksheets and copy rows?

Hybrid View

  1. #1
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to search for text across multiple worksheets and copy rows?

    Try this:
    Sub x()
      
    Dim rFind As Range, sFind As String, sAddr As String, ws As Worksheet
     
    sFind = "Change Order"
    
    For Each ws In Worksheets
        If ws.Name <> "Summary" Then
            With ws.UsedRange
                Set rFind = .Find(What:=sFind, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
                If Not rFind Is Nothing Then
                    sAddr = rFind.Address
                    Do
                        ws.Cells(rFind.Row, 2).Resize(, 8).Copy Sheets("Summary").Range("A" & Rows.Count).End(xlUp)(2)
                        Sheets("Summary").Range("I" & Rows.Count).End(xlUp)(2) = ws.Name
                        Set rFind = .FindNext(rFind)
                    Loop While rFind.Address <> sAddr
                    sAddr = ""
                End If
            End With
        End If
    Next ws
         
    End Sub

  2. #2
    Registered User
    Join Date
    04-17-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How to search for text across multiple worksheets and copy rows?

    Wow that worked like a charm! You probably just saved me hours of tedious work. Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1