+ Reply to Thread
Results 1 to 6 of 6

Matching two columns and copying the corresponding rows to a new sheet

Hybrid View

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

    Re: Matching two columns and copying the corresponding rows to a new sheet

    Try this:
    Sub x()
    
    Dim r As Range, r2 As Range
    
    For Each r In Sheet1.Range("B4", Sheet1.Range("B" & Rows.Count).End(xlUp))
        Set r2 = Sheet2.Range("B:B").Find(What:=r.Value, lookAt:=xlWhole, MatchCase:=False)
        If Not r2 Is Nothing Then
            r.EntireRow.Copy Sheet3.Range("A" & Rows.Count).End(xlUp)(2)
            Set r2 = Nothing
        End If
    Next r
    
    End Sub

  2. #2
    Forum Contributor
    Join Date
    03-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    491

    Re: Matching two columns and copying the corresponding rows to a new sheet

    Thank you,

    What if I wanted to match the columns with the job description?
    How would I alter the code?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Matching data and copying row to different sheet
    By DanishDudeAU in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-29-2013, 04:59 AM
  2. [SOLVED] Copying data into new sheet depending upon selection of rows or columns
    By vickyyar in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-13-2012, 11:59 AM
  3. Copying rows from sheet where cells in specific columns are empty
    By wishmaker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2010, 10:11 AM
  4. Replies: 3
    Last Post: 10-08-2009, 02:22 PM
  5. Matching one to many from one sheet to another, then copying
    By bluegnu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-10-2009, 06:49 AM

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