+ Reply to Thread
Results 1 to 8 of 8

Copy data between worksheets

  1. #1
    Registered User
    Join Date
    05-03-2021
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    8

    Question Copy data between worksheets

    Hi everyone!

    I am very new to Excel VBA and I have been struggling with a task which seems easy but I can't make it work. I have one worksheet (Main) into which I need to copy data from another worksheet (RDMS). The RDMS worksheet has around 6000 rows and columns from A:BV. In column A, it has a unique number for each entry.

    Now I need to write a code that looks at the unique number in column A in the RDMS worksheet and if the number is not yet in the Main worksheet, it will paste specific columns from this row into Main worksheet (for example row B, C, AA and BV). If the unique number is already present in the Main sheet from before (because this will be a live document being updated) it will simply skip it.

    Would anyone be able to give me a hand with this code?

    Auxcron
    Attached Files Attached Files
    Last edited by Auxcron; 06-04-2021 at 08:20 AM.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,295

    Re: Copy data between worksheets

    lot easier to work with the workbook.

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    05-03-2021
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Copy data between worksheets

    Hi thanks for your message, I have now updated my post with the worksheet. It has got 3 tabs, the Main sheet which is empty, RDMS tab with data and Main I want which shows my desired output.

    Thank you

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,295

    Re: Copy data between worksheets

    Macro on blue button.
    As there is nothing in the 'Main' sheet, on the first pass all data from 'RDMS' should fill sheet.
    After the first pass, only any added data into 'RDMS' should append to sheet 'Main'
    torachan.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-03-2021
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Copy data between worksheets

    Hi, thank you very much for your code! It works nice, the only thing is that it is a little bit slow, I am not sure if that is because of the nature of the code or whether that is something on my end? I would say it is currently completing 1 row in 1-2 seconds.
    Last edited by Auxcron; 06-07-2021 at 03:57 AM.

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,295

    Re: Copy data between worksheets

    Try the attached - I have switched off 'calculations' & 'screen updating' just for the process - switches back on after completion.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-03-2021
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Copy data between worksheets

    Hi,

    amazing, this is much faster! Thank you so so much. One last question, if I only wanted to loop through rows in RDMS that contain certain value in column T, how could I add this constraint into the code?

    Auxcron

  8. #8
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,295

    Re: Copy data between worksheets

    The attached on sheet 'FilterT' generates new content from sheet 'RDMS' on press of button.
    Userform then appears to make filtered choice from column 'T'.
    You will note the row numbers are not consecutive after the filter - reset will show the complete table.
    torachan.
    Attached Files Attached Files

+ 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. Copy worksheets (names, data and format) from saved data file to open active workbook
    By cdtouchberry in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2019, 07:51 PM
  2. Macro to copy data from 3 different worksheets with different columns and rows of data
    By Louise_Hughes in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-12-2014, 07:38 AM
  3. Saving copy of data and then running macro on all active worksheets in saved copy?
    By Science87 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2014, 11:56 AM
  4. Copy/Paste Range of Data from Multiple Workbooks/Worksheets to Master Workbook/Worksheets
    By NumberCruncher311 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-19-2013, 08:21 PM
  5. Copy data between two worksheets
    By koiman in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-28-2012, 05:19 PM
  6. Macro to copy row data into new worksheets and separate delimited data
    By asuguy83 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-25-2012, 08:11 PM
  7. Copy and paste data in different worksheets of workbookA to diff worksheets in workbookB
    By preciousmetal2004 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-24-2012, 05:50 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