+ Reply to Thread
Results 1 to 8 of 8

Export Sheet to new Workbook

  1. #1
    Forum Contributor
    Join Date
    08-06-2007
    Posts
    105

    Export Sheet to new Workbook

    Hello,

    I am looking for a VBA code that will look at sheet 2 and Sheet 3 and if there is data present to export them to a new workbooks. They need to be seperate workbooks - is this possible?

    If there is no data, then the code should do nothing.

    Thank you in advance.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Excel VBA - Export Sheet to new Workbook

    Maybe something like this...this will prompt you asking for a filename:

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 02-25-2010 at 01:53 PM. Reason: update CountA
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    08-06-2007
    Posts
    105

    Re: Excel VBA - Export Sheet to new Workbook

    I put in the VBA however it didn't do anything when I ran the code.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Excel VBA - Export Sheet to new Workbook

    Let's make sure it's in the right place:

    How/Where to install the macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet as a macro-enabled workbook.

    The macro is installed and ready to use. Press Alt-F8 and select it from the macro list.

    If it still does nothing at all, try restarting Excel and reloading the newly saved workbook.

  5. #5
    Forum Contributor
    Join Date
    08-06-2007
    Posts
    105

    Re: Export Sheet to new Workbook

    Please see the attached - when you run it, it doesn't do anything.
    Attached Files Attached Files

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Export Sheet to new Workbook

    Change this and try again:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-06-2007
    Posts
    105

    Re: Export Sheet to new Workbook

    Thanks! That worked however I do not like how it forces you to save - is there a way to change this? I was thinking if anything I'd like it to auto save as below:

    Please Login or Register  to view this content.

    "Seg" and "PONumber" are defined earlier in my code. This is an addition to an already existing code.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Export Sheet to new Workbook

    Looks like a plan.

    If that takes care of your need, use the Thread Tools menu to mark the this thread as [SOLVED].


    (Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated. It is found across from the "time" in each of our posts.)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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