+ Reply to Thread
Results 1 to 7 of 7

Copy active worksheet to new workbook

  1. #1
    Registered User
    Join Date
    09-13-2014
    Location
    Belgium
    MS-Off Ver
    2007
    Posts
    14

    Copy active worksheet to new workbook

    Hello there,

    I have been searching the internet for a macro/vba code that can do the following:

    Copy active worksheet/export data, without:
    - hidden rows or columns
    - slicers
    - hyperlinks
    - formulas
    - the first 12 rows

    And past it to a new workbook, without changing lay-out (colours, column width etc.).

    With this code, I can insert a "button" in all of my sheets in 1 excel file, so if you click on it, that specific sheet (active sheet) will open in a new workbook.

    Can someone please help me?
    I have been searching the internet like crazy, but none of the codes seems to work..or are too long so that my file is very slow in opening and saving.

    Thank you!

    Gr.,
    Erika

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy active worksheet to new workbook

    Hi Erika,

    Welcome to the Forum!

    Try:

    Please Login or Register  to view this content.
    * I haven't figured out whether we need to or how to get rid of the slicer
    Last edited by xladept; 09-13-2014 at 03:43 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    09-13-2014
    Location
    Belgium
    MS-Off Ver
    2007
    Posts
    14

    Re: Copy active worksheet to new workbook

    Hi XLAdept,

    Thank you !

    I tried your code, it's very good, thank you. I added a few things:

    Please Login or Register  to view this content.
    This code deletes the slicer . But it isn't a 100% correct yet..

    I noticed the following things:
    - it also copies the other sheets
    - it doesn't maintain the layout of a pivottable, f.e.: the title of the columnheader (of the pivottable) is in bold, but in the new workbook (copy), the columnheader isn't bold anymore
    - it closes the original file with the macro, while I would like it to be still open (in the background)

    Can you help me with this? I don't know much about vba, but I'm learning!

    THANK YOU FOR YOUR HELP!!

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Copy active worksheet to new workbook

    Hi,

    What's the ultimate aim here?

    Have you considered using an Excel Template for starting with a new workbook instead of using an existing workbook and removing things from it?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy active worksheet to new workbook

    Hi Erika,

    We're doing a paste values to eliminate the formulas that probably also messes up your other formats - so, I suspect that changing the PasteSpecial parameters will be able to recover your formats - I had tried something similar with the pivot caches, it will be interesting to see how that works with the new parameters

  6. #6
    Registered User
    Join Date
    09-13-2014
    Location
    Belgium
    MS-Off Ver
    2007
    Posts
    14

    Re: Copy active worksheet to new workbook

    Hi all,

    I have a file, 'parent file', with a couple of sheets. In each sheet is a different pivottable with slicers.
    The aim is to go to a specific sheet where you can choose which information you want (from the slicers). Than have an option to 'download' that specific sheet to a new file (with only hard values, and other things as listed above). This way the parent file stays intact for further use, and I can start experimenting with the info in the downloaded file.

    Can you guys help me so that the code might work? I don't really know how to go further..nor do I know if my suggested code makes any sense .

    Thank you!

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy active worksheet to new workbook

    Maybe:

    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 worksheet from closed workbook into active/existing workbook.
    By rasikvekaria in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2012, 06:55 AM
  2. [SOLVED] Copy Worksheet (from another workbook) to an Active Workbook
    By tt388 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2012, 09:47 PM
  3. Copy Active Worksheet To another workbook
    By Ironman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-17-2011, 03:53 PM
  4. copy range from active worksheet to another workbook
    By omarq in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-03-2011, 06:21 PM
  5. Macro to copy entire active row to another worksheet and another workbook
    By SalesGuy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-27-2011, 10:38 AM

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