+ Reply to Thread
Results 1 to 7 of 7

Copy rows to master sheet based on contents in column

  1. #1
    Registered User
    Join Date
    06-24-2016
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    24

    Copy rows to master sheet based on contents in column

    I have a workbook with a number of sheets, all with the same layout - data is in columns A:K starting on row 3.
    I need to be able to copy the entire row on each sheet into the 'Master' sheet whenever any data is entered in column I.
    Any help is appreciated.

  2. #2
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Copy rows to master sheet based on contents in column

    Put the code below in the workbook object and that should do it.
    Please Login or Register  to view this content.
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  3. #3
    Registered User
    Join Date
    06-24-2016
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    24

    Re: Copy rows to master sheet based on contents in column

    Thanks for that.
    It's close, but it's only populating rows 3 and 4 of the Master sheet. Any changes to column I on any of the others just gets copied to row 4 on Master.
    Nothing gets copied on rows below this.

    Also, how would I amend this to run manually, for existing entries?

  4. #4
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Copy rows to master sheet based on contents in column

    I'm shooting blind a little without seeing your data and structure. Do the rows that get copied have all cells (especially the cell in col A) populated? If not then this:
    Please Login or Register  to view this content.
    won't pick up the actual last row, just the last populated row in column A.

    If that is the issue, then change that line to this:
    Please Login or Register  to view this content.
    If that's not the issue, then post your file and I'll have a look.

  5. #5
    Registered User
    Join Date
    06-24-2016
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    24

    Re: Copy rows to master sheet based on contents in column

    Apologies; it works fine as is.
    It was the fact that I was trying dummy data in column I to test, without anything in column A.

    If I wanted to run this manually on the existing data, what would I need to change, please?

    Thanks for your help with this.

  6. #6
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Copy rows to master sheet based on contents in column

    If by "manually" you mean you want to run it from the code window, then you need to move the code into a module (call the sub "CopyRows" or something) then replace all the code in the worksheet change event with this line:
    Please Login or Register  to view this content.
    And then you can hit F5 in the CopyRows sub in the module you created. The reason is that - as you have probably discovered - you cannot run the worksheet change event manually because it needs to be passed two parameters (sheet and target).

  7. #7
    Registered User
    Join Date
    06-24-2016
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    24

    Re: Copy rows to master sheet based on contents in column

    Thanks for your help.

+ 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. use cell value to open up workbook and copy contents into master sheet
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-14-2015, 10:09 PM
  2. Replies: 9
    Last Post: 05-27-2015, 06:28 AM
  3. Replies: 1
    Last Post: 09-15-2014, 01:03 PM
  4. Copy rows from master sheet to other sheets based on criteria
    By spikeysas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2011, 04:28 AM
  5. Copy rows from master sheet to other sheets if certain cell in column is blank
    By nadiaraciti in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-29-2011, 02:05 AM
  6. Copy rows from a master sheet based on condition
    By Rohun Heesen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2011, 08:33 PM
  7. Replies: 0
    Last Post: 02-02-2011, 06:42 PM

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