Results 1 to 4 of 4

Tweaking Macro to match and find two cell values not just one

Threaded View

Zawoooo Tweaking Macro to match and... 12-16-2012, 08:16 AM
AlphaFrog Re: Tweaking Macro to match... 12-16-2012, 11:43 AM
Zawoooo Re: Tweaking Macro to match... 12-16-2012, 06:14 PM
AlphaFrog Re: Tweaking Macro to match... 12-16-2012, 06:51 PM
  1. #1
    Registered User
    Join Date
    12-02-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    9

    Tweaking Macro to match and find two cell values not just one

    Hey again,

    Thank to rylo i am very close to getting this macro to work perfectly!

    I have tried to edit it but have failed miserably.

    This was the inital macro written

    Sub aaa()
    Dim OutSH As Worksheet
    Set OutSH = Sheets("Sheet1")
    Sheets("Sheet2").Activate

    outcol = OutSH.Cells(3, Columns.Count).End(xlToLeft).Offset(0, 1).Column
    For i = 3 To Cells(Rows.Count, 3).End(xlUp).Row
    Set findit = OutSH.Range("A:A").Find(what:=Cells(i, 3).Value)
    OutSH.Cells(findit.Row, outcol).Value = Cells(i, 5).Value
    Next i

    End Sub
    It does the trick but there is a slight problem as it only matches one cell value. Which was fine at first until i realized there can be multiple results for a keyword search and it would only insert one.(see Test 2 Orange)

    What i have been trying to do is, find cell A3 and B3 from sheet one in sheet two and then copy over the position cell value and then repeat for the rest
    Attached Files Attached Files
    Last edited by Zawoooo; 12-16-2012 at 10:41 PM.

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