+ Reply to Thread
Results 1 to 3 of 3

Help! How do I do the following in one process instead of bouncing between 2 worksheets?

  1. #1
    Registered User
    Join Date
    02-21-2018
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    1

    Help! How do I do the following in one process instead of bouncing between 2 worksheets?

    I'm too new to VBA to know how to approach this. My code works, but I think it's sloppy and I'm looking for a hand to save or copy each cell that I need in my original workbook and pasting it in specific different cells in my 2nd workbook. My way has the active workbook bouncing back and forth but there has to be a way to get it all in a single transfer which should improve speed and resources. I didn't include the rest of my code after this where I have an "Else" with other stuff, but this is where my problem lies. Any advice or help would be appreciated and you can assume I don't know much if you want to be really clear for me with you help I'd be really grateful!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Help! How do I do the following in one process instead of bouncing between 2 worksheet

    Remove all the lines that end in .Activate. All the other code is fully qualified so those lines are unnecessary.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Help! How do I do the following in one process instead of bouncing between 2 worksheet

    You've actually done all the heavy lifting already. You've fully qualified each copy-paste line with the workbook and worksheet. So there is no need to Activate each workbook. Simply delete each line that has .Activate e.g.;...

    Please Login or Register  to view this content.
    As far as copy-pasting all the areas with an all-in-one command, there is not a way to do that. Each of your areas is different in size and in one case you are transposing the data. The way you have it now (sans the .Activate lines) isn't so bad.

    A slightly Faster method than copy and PasteSpecial is simply the Destination.Value = Source.Value method e.g.;

    Please Login or Register  to view this content.
    The Destination and Source ranges have to be the same size. It only transfers Values, no formats or anything else.


    One other tip; this really doesn't improve performance, but it makes your code more concise. If you set a worksheet variable for both your source an destination sheets, the parent workbooks are qualified in those worksheet variables and you can use a shorter syntax like this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ 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. vba macro to batch process adding worksheets
    By SKooLZ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2015, 05:07 AM
  2. Executing a bouncing sheep whilst the code/macro runs
    By mike_vr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-03-2013, 08:21 AM
  3. [SOLVED] Not returnin to previously visited cell after bouncing around in spreadsheet during macro.
    By arcqca in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-10-2013, 09:55 AM
  4. Kill a second Excel process from the first excel process
    By sebair in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2012, 05:40 PM
  5. VBA Macro to process duplicate phone numbers in 3 worksheets
    By delforum in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-07-2011, 11:02 AM
  6. How to count process running time ( process not finished)
    By miao jie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2005, 06:06 AM
  7. How to count process running time ( process not finished)
    By miao jie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2005, 02:06 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