+ Reply to Thread
Results 1 to 14 of 14

Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another Cell

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Question Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another Cell

    Dear all masters,
    I want to one suitable code. Read Entire "A" column and O Column,

    if matches same value,

    Paste to J, K column from Q,R columns Relevant Values.

    Example:

    Your code is reads Entire "A" Column, and reads one value as a "65",

    and now reads Entire O Column,

    And found same Value As a "65" at O3 Cell

    Now Take The Values From Q3 and R3

    And Paste to J3 and K3 ( i.e, 230 and 10)

    This is process for lookup and paste the values to target cells until end of "A" Column end page data, to J and K columns.

    Kindly Make the Good Macro code.

    Please find the Example file.

    Thanking You All.

    Best Regards,
    Prasad.
    Attached Files Attached Files
    Last edited by pvsvprasad; 08-10-2016 at 11:27 AM.

  2. #2
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another

    This is the Screenshot for Example output file.
    Attached Images Attached Images

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,080

    Re: Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another

    Try:
    Sub CompareCols()
        Application.ScreenUpdating = False
        Dim Rng As Range
        Dim foundVal As Range
        Dim LastRow As Long
        LastRow = Range("A" & Rows.Count).End(xlUp).Row
        For Each Rng In Range("A3:A" & LastRow)
            Set foundVal = Range("O:O").Find(Rng, LookIn:=xlValues, lookat:=xlWhole)
            If Not foundVal Is Nothing Then
                Range("Q" & foundVal.Row) = Range("J" & Rng.Row)
                Range("R" & foundVal.Row) = Range("K" & Rng.Row)
            End If
        Next Rng
        Application.ScreenUpdating = True
    End Sub
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Question Re: Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another

    Dear sir,

    Thank you for providing the code. but your code is not producing @ J and K columns.

    And Erased Existing Q and R Columns after using code.

    Please find the Image.

    Kindly make the correction for smooth and fast working code.

    Thanking you.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by pvsvprasad; 08-10-2016 at 12:18 PM.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,080

    Re: Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another

    My apologies. I got the ranges reversed. Try:
    Sub CompareCols()
        Application.ScreenUpdating = False
        Dim Rng As Range
        Dim foundVal As Range
        Dim LastRow As Long
        LastRow = Range("A" & Rows.Count).End(xlUp).Row
        For Each Rng In Range("A3:A" & LastRow)
            Set foundVal = Range("O:O").Find(Rng, LookIn:=xlValues, lookat:=xlWhole)
            If Not foundVal Is Nothing Then
                Range("J" & Rng.Row) = Range("Q" & foundVal.Row)
                Range("K" & Rng.Row) = Range("R" & foundVal.Row)
            End If
        Next Rng
        Application.ScreenUpdating = True
    End Sub

  6. #6
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another

    Excellent sir,

    Now your code did wonders

    Thank you very much sir.

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,080

    Re: Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another

    Glad to help.

  8. #8
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another

    Dear sir,

    kindly make small modification for filling of columns. observe the attached image.

    One of the Friend from this site is developed as below code for filling. kindly combine below code and your code.


    Sub filldata_ascending_incolumnA_()

    'from top to below (ascending)

    Range(Range("a2"), Cells(Rows.Count, 1).End(xlUp).Offset(, 0)). _
    SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"

    End Sub



    Thanking you sir.
    Attached Images Attached Images
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,719

    Re: Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another

    @pvsvprasad
    Show us some examples of what you have tried yourself to make it work.

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,719

    Re: Look Up To Columns, if Match The Same Values Paste to Relevant Cell Values to Another

    Sub Maybe()
        Dim c As Range
        For Each c In Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row)
            Range("O3:O" & Cells(Rows.Count, 15).End(xlUp).Row).Find(c.Value, lookat:=xlWhole).Offset(, 2).Resize(, 2).Copy c.Offset(, 9)
        Next c
    End Sub

+ 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. [SOLVED] Almost There! Match values in two columns and return text in adjacent cell
    By mrkake in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-01-2016, 02:14 AM
  2. Using Sumif() to find cell with match values in two columns
    By my2108 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-10-2015, 03:14 AM
  3. [SOLVED] Searching within a single cell and summing up relevant values
    By iambong in forum Excel General
    Replies: 6
    Last Post: 06-08-2015, 04:57 AM
  4. Replies: 7
    Last Post: 05-07-2015, 07:29 AM
  5. [SOLVED] How to compare two string in two different workbooks and Copy the relevant values & Paste?
    By somani123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-13-2014, 06:47 AM
  6. Copy and Paste columns based on cell values
    By devin1428 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2012, 07:50 AM
  7. Match value in one cell with values in multiple columns
    By sa02000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2010, 05:12 AM

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