Results 1 to 12 of 12

Copyin data from sheet to another if values are same

Threaded View

  1. #1
    Registered User
    Join Date
    01-24-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Copyin data from sheet to another if values are same

    This is the code i use:

    [I
    ]Sub similar()
        Dim Sht1Rng As Range
        Dim Sht2Rng As Range
         
        Set Sht1Rng = Worksheets("firts").Range("A1", Worksheets("firts").Range("A1100").End(xlUp))
        Set Sht2Rng = Worksheets("second").Range("A1", Worksheets("second").Range("A1100").End(xlUp))
         
        For Each c In Sht1Rng
            Set d = Sht2Rng.Find(c.Value, LookIn:=xlValues)
            If Not d Is Nothing Then
                Worksheets("Results").Range("A1100").End(xlUp).Offset(1, 0).Value = c.Value
                Worksheets("Results").Range("A1100").End(xlUp).Offset(0, 1).Value = c.Offset(0, 1).Value
                Set d = Nothing
            End If
        Next c
    End Sub
    [/I]

    It selects similar values from column A from these sheets, and puts it into results sheet. In addition to this, what I need is to pick up the whole row from the sheet "Second". I have tried adding

    Worksheets("second").Range(d).EntireRow.Select


    after looking for similar values, but this causes error. I also need to pick up one more value from sheet "first" and add it to the last column in "results" sheet, but this is secondary problem..
    Last edited by arlu1201; 01-24-2013 at 09:49 AM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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