+ Reply to Thread
Results 1 to 5 of 5

Copy worksheet data into new workbook

  1. #1
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    170

    Copy worksheet data into new workbook

    Hello All,

    I've been asked by my boss to create a macro that will quickly backup the whole file I'm working on into a new workbook. Here's the kicker, only the data. Simply copying the worksheets won't work since there is code embedded in the worksheets themselves. So the best I could come up with was to select and copy the cells directly since this would override any and all code I've written in. Please see my code below. It keeps failing at two parts. I'll label it in the code.


    Please Login or Register  to view this content.
    Any help would be great. Also since I intend to do this for multiple worksheets in the same workbook any help to speed it up would be great. Of course the selection range for each would need to be different.

    Thanks,
    Dan

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copy worksheet data into new workbook

    Hi Dan

    Looking at the Code, I'd suggest your trying to Select on an inactive Workbook.

    For example, in this line of Code, orgwb is not the Active Workbook thus, the Code will fail.
    Please Login or Register  to view this content.
    Similarly for this line of Code...newwb is not the Active Workbook.
    Please Login or Register  to view this content.
    Perhaps.....
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Copy worksheet data into new workbook

    Hi Dan,

    Try something like this...

    Please Login or Register  to view this content.
    Stephen

  4. #4
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    170

    Re: Copy worksheet data into new workbook

    Stephen - Your solution works great. How can I adapt this code to repeat the process for the rest of the worksheets in my original file.

  5. #5
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    170

    Re: Copy worksheet data into new workbook

    Well I kept playing around with it and got a solution that I am happy with. I've posted below. Thanks to everyone for your assistance and direction.

    Please Login or Register  to view this content.

+ 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 data from one worksheet to new workbook
    By abraham30 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-21-2014, 07:24 AM
  2. How to copy data from one workbook to a specific worksheet of another workbook
    By VidyaVallaba in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-20-2014, 03:44 AM
  3. [SOLVED] Copy Data from Range on Specific Worksheet and Transfer Data to New Workbook
    By s2jrchoi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-22-2013, 08:24 AM
  4. [SOLVED] Copy data from one worksheet to another worksheet and or another workbook
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-11-2012, 08:13 AM
  5. [SOLVED] copy data from worksheet to worksheet of same name in another workbook
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-25-2012, 12:42 PM
  6. Copy data from one worksheet into new tab of a different workbook
    By davidparkes in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-06-2011, 12:34 PM
  7. i need data to copy to next worksheet in workbook
    By hbasten in forum Excel General
    Replies: 3
    Last Post: 05-31-2009, 03:23 PM
  8. Replies: 1
    Last Post: 03-16-2006, 03:00 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