+ Reply to Thread
Results 1 to 8 of 8

Macro to save a single worksheet from a multiple sheet workbook into a new workbook

  1. #1
    Registered User
    Join Date
    03-29-2014
    Location
    Portugal
    MS-Off Ver
    Excel 2013
    Posts
    73

    Macro to save a single worksheet from a multiple sheet workbook into a new workbook

    Hi, need help modifying the following macro to create a new workbook from a single sheet in a multiple page workbook.

    I need it to do the following:
    1- Save just a range (B4:O128) not the entire worksheet
    2- Create a folder in the desktop, folder name should be same as value of E16 of that worksheet, say Sheet6
    3- Filename the same name as the folder

    At the moment line 4 which is commented out generates an error, line 5 does save a copy but puts it on the root directory which is not what I am after, any ideas please!!

    Thanks in advance

    Please Login or Register  to view this content.

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

    Re: Macro to save a single worksheet from a multiple sheet workbook into a new workbook

    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.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Macro to save a single worksheet from a multiple sheet workbook into a new workbook

    To just save the Range.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    03-29-2014
    Location
    Portugal
    MS-Off Ver
    Excel 2013
    Posts
    73

    Re: Macro to save a single worksheet from a multiple sheet workbook into a new workbook

    Awesome !!!! when you know you just know

    Thank you both

  5. #5
    Registered User
    Join Date
    03-29-2014
    Location
    Portugal
    MS-Off Ver
    Excel 2013
    Posts
    73

    Re: Macro to save a single worksheet from a multiple sheet workbook into a new workbook

    The sheet in question is sheet 6, and it has a particular format that I want to save to the new worksheet.

    The code above does save the file and create the folder just fine but only saves the data, no format!!!

    We can also save it with the same format right? BTW the format I want to keep is within the range "B4:O128"

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Macro to save a single worksheet from a multiple sheet workbook into a new workbook

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-22-2018
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    1

    Re: Macro to save a single worksheet from a multiple sheet workbook into a new workbook

    Hey guys, im very new and ignorant to VBA. Similar to this, im trying to create a macro button that will save that entire sheet to a separate workbook. The code ive been trying is below, but I have no idea what im doing haha. Any advice as to what im doing wrong. I'm getting a compile:Syntax error.Thanks,

    Sub Button3_Click()
    Dim wb As Workbook
    Set wb = Workbooks.Add
    Embed PRG Value Added Sales Tools (Greg).Sheets("Sheet13").Copy Before:=wb.Sheets(1)
    wb.SaveAs "C:\temp\test1.xlsx"
    End Sub
    Attached Images Attached Images

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Macro to save a single worksheet from a multiple sheet workbook into a new workbook

    Good morning Greg94.
    Please read the "Forum Rules", at the top. You should be interested in #2.
    Have a good weekend.

+ 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. Macro to save a single worksheet from a multiple sheet workbook
    By tfilipe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2018, 08:01 PM
  2. Save a single worksheet from a workbook as a separate read only workbook
    By jmking1999 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2017, 09:49 AM
  3. [SOLVED] Macro to Combine Multiple Workbook Data into Single Target Workbook
    By Jimbo42 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2014, 08:26 PM
  4. Save Single Sheet from multiple sheet workbook as MSDOS CSV format
    By BBen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-11-2012, 08:34 AM
  5. How can I save a single sheet of a workbook using a macro
    By prouddad in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-02-2009, 03:02 AM
  6. how do i save a single sheet from my workbook?
    By eyesonly1965 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-14-2006, 03:35 PM
  7. [SOLVED] Save a single sheet from a workbook
    By JAMES T. in forum Excel General
    Replies: 3
    Last Post: 01-25-2005, 11: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