+ Reply to Thread
Results 1 to 8 of 8

Difference in speed copying an entire table vs a select number of rows?

  1. #1
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Difference in speed copying an entire table vs a select number of rows?

    Hi all,

    I have a macro which basically copies auto-filtered data from table 1 to a new table. It works great.

    I'm now interested in making a comparison between table 1 and table 2. They have the same layout. So, I would want to copy both table 1 & 2 to a new sheet (as two tables or into two tables next to each other). Calculations would be like Column A table 1 - Column A from table 2. This would then be done in a new table or area to the far right.

    As you can see below, the macro copies the entire range from A:AV. That's 47 columns, I think.

    In actuality, I may only really be interested in say 15 columns in total. The problem is of course that they're not adjoined and I may want say column D, I, M, S and X instead of a continuous range of columns.

    For me, who's not a good coder, it might be best to simply copy A:AV from both tables into a separate area each and then add a new table which extracts data from each copied table and makes calculations.

    For me, that works fine if the speed isn't an issue. Of course, the sheet may become fairly large, but I imagine that should not be a big issue.

    The question I have then is if it's worth improving this macro to copy a select number of columns or if I should just go with copying the entire table?

    Copying the entire table seems to happen fairly fast, so it might not be an issue to worry about.

    Thanks in advance for all help and pointers.


    Please Login or Register  to view this content.
    Last edited by Elijah; 08-24-2019 at 06:32 AM.

  2. #2
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: Difference in speed copying an entire table vs a select number of rows?

    Trying to solve this one on my own now, but wound up stuck.

    The code above runs well for the active workbook/sheet and copies data from there to the other workbook/sheet. But how do I set it up to do the copy date fram the other workbooks main sheet?

    Please Login or Register  to view this content.
    I assume this part needs to be changed. I tried a few things, but no luck yet.

    Does the other workbook (FullDay2) and worksheet (FullDay) needs to be defined as a variable or can I just reference it directly?

    Thanks in advance.

  3. #3
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: Difference in speed copying an entire table vs a select number of rows?

    Initial attempt was

    Please Login or Register  to view this content.
    But not go...getting errors inside the editor.

  4. #4
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: Difference in speed copying an entire table vs a select number of rows?

    Figured it out. The code in #3 worked. I had a parantheses too much.

  5. #5
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: Difference in speed copying an entire table vs a select number of rows?

    Okay. So this is the solution I came up with.

    Basically, one macro which runs two macro where each copies data to a table each. To the far right is a third table which compares data from the two tables. I may choose a different layout. For example copy these two tables to the far right and have my 'comparison' table to the far left.

    Two workbooks attached. Both macros run from PartDay2. It takes about 2 seconds for a full table. I think I can live with that.

    Thoughts/improvements?

    Thanks in advance.
    Attached Files Attached Files
    Last edited by Elijah; 08-24-2019 at 12:00 PM.

  6. #6
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: Difference in speed copying an entire table vs a select number of rows?

    The solution I suggested seems to work okay. It copies an entire table and many columns I don't use, but it does not appear to be that slow. A total of 1-2 seconds. I can live with that for now.

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,451

    Re: Difference in speed copying an entire table vs a select number of rows?

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  8. #8
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: Difference in speed copying an entire table vs a select number of rows?

    Well, I kind of solved this one myself, but putting it as solved now then.

+ 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. Replies: 1
    Last Post: 05-31-2017, 04:20 PM
  2. VBA select the entire Table row below ActiveCell
    By kaseyleigh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2014, 09:05 AM
  3. Macro to select 1 column and a variable number of table rows.
    By Foxquilter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2014, 10:38 AM
  4. how to select rows after particular difference in value
    By genetist in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2013, 06:12 AM
  5. Select and copy n number of rows from Filtered Table
    By Swindo in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-24-2013, 09:30 PM
  6. [SOLVED] Copying the entire row from TABLE A that meets certain criteria to another Table
    By jjin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-17-2012, 08:56 PM
  7. [SOLVED] Macro to select 4 entire rows and then delete rows
    By Scott Viney in forum Excel General
    Replies: 3
    Last Post: 09-22-2005, 03:05 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