+ Reply to Thread
Results 1 to 4 of 4

VBA to match value in column, offset by 1 and then copy all rows to end

  1. #1
    Registered User
    Join Date
    05-02-2018
    Location
    Brighton, England
    MS-Off Ver
    Excel 2016
    Posts
    21

    VBA to match value in column, offset by 1 and then copy all rows to end

    Hi,

    I currently have the below macro that will copy data from one sheet to another,

    At the moment the below code will copy all cells from A2:DT in workbook 2 and paste at A2 in workbook 1. It the deletes all data in workbook 2 ready for new data to be inputted.

    Please Login or Register  to view this content.
    Due to circumstances I am no longer able to delete data in workbook 2 however if I were to continue as is I would end up with duplicates in workbook 1.

    All rows are assigned a specific value increase from 1 to infinity that is populated in column A and refered to as Sales ID

    I have a cell located in workbook 1 that has a max formula that returns the last posted Sales ID (Currently a 4879 and located at Cell M3 of sheet 4)

    Essentially what I need to do is have the macro refer to this cell, match the cell in Workbook 2 and then copy from the row below to the last row.

    I think I need something along the lines of the below to reference the value that I want to match however I cannot work out how to then search through column A in workbook 2 and then only copy rows below

    Please Login or Register  to view this content.
    If there is somthing simple I am missing please let me know!

    Thanks

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA to match value in column, offset by 1 and then copy all rows to end

    Maybe something like this

    Please Login or Register  to view this content.
    Last edited by JLGWhiz; 09-13-2019 at 05:07 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    05-02-2018
    Location
    Brighton, England
    MS-Off Ver
    Excel 2016
    Posts
    21

    Re: VBA to match value in column, offset by 1 and then copy all rows to end

    Awesome, that's worked perfectly!

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA to match value in column, offset by 1 and then copy all rows to end

    Happy to help,
    Regards, JLG

+ 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. Match column between sheet, copy offset, combine duplicate
    By keyboard_jv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-23-2018, 08:09 PM
  2. Copy and paste rows from data onto sheets that match first column
    By sean.dolan93 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-20-2017, 03:40 PM
  3. Match 2 Columns in two sheets; copy an offset Column of matched Row to Sheet 1
    By sureng20 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-01-2017, 03:08 AM
  4. Replies: 5
    Last Post: 10-23-2015, 12:35 PM
  5. [SOLVED] Dynamic Name Range using Offset&Match with Match based off a different column
    By mdlpjr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-16-2013, 06:33 PM
  6. Copy rows that match values in a column of names
    By lunatyck in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2012, 11:22 AM
  7. Match column from sheet 2 to sheet 1 and copy rows if match exists.
    By GravityInvert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2008, 01:42 PM

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