+ Reply to Thread
Results 1 to 2 of 2

macro to match data

  1. #1
    Registered User
    Join Date
    09-04-2013
    Location
    white river,south africa
    MS-Off Ver
    2010
    Posts
    9

    macro to match data

    Hi
    I am using this code to match and copy data from sheet1 to sheet2. I need it to paste the data from sheet1 column b to sheet 2 column d and not b as in the code.

    Sub copyweights()

    Dim ws1 As Worksheet
    Dim ws2 As Worksheet
    Dim rng1 As Range
    Set ws1 = Sheets(1)
    Set ws2 = Sheets(2)
    Set rng1 = ws2.Range(ws2.[A1], ws2.Cells(Rows.Count, "a").End(xlUp))
    With rng1.Offset(0, 1)
    .FormulaR1C1 = "=IF(RC[-1]<>"""",IF(NOT(ISNA(MATCH(RC[-1],'" & ws1.Name & "'!C[-1],0))),INDEX('" & ws1.Name & "'!C,MATCH(RC[-1],'" & ws1.Name & "'!C[-1],0)),""no match""),"""")"
    .Value = .Value
    End With
    End Sub

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: macro to match data

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

+ 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] Macro to match data from 2 columns
    By Chris herbert in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-25-2013, 05:42 PM
  2. Replies: 0
    Last Post: 08-09-2013, 05:54 PM
  3. [SOLVED] Macro to Match Data and calculate the Mac
    By forexcellence13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2013, 02:06 AM
  4. A macro to match and organize data
    By AnctEgypt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-10-2012, 08:43 AM
  5. Macro to Match Data from 2 different Sheets
    By Mpahl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2011, 08:03 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