+ Reply to Thread
Results 1 to 2 of 2

Save As Separate File

  1. #1
    Registered User
    Join Date
    05-23-2018
    Location
    Texas, United States
    MS-Off Ver
    2013
    Posts
    39

    Save As Separate File

    I want to create a new file from an existing workbook's sheet and save it with a name that comes from the original sheet. Here's the code i'm working with

    current_window = Sheets("Mapping").Range("C3").Value 'current Window name
    New_file = Sheets("Mapping").Range("c4").Value 'new file name to save as

    Workbooks.Add
    new_window = ActiveWorkbook.FullName 'sets new file window

    Windows(current_window).Activate

    'Copy data in old sheet to new workbook
    Sheets("PNL Summary").Select
    Cells.Select
    Selection.Copy

    Windows(new_window).Activate
    Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
    , SkipBlanks:=False, Transpose:=False


    Sheets("Sheet1").Name = "Jake"
    Application.CutCopyMode = False

    'Save new workbook with file name that was set in old workbook
    ActiveWorkbook.SaveAs NewFile ' I get an error here each time

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Save As Separate File

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. Save each PPT slide as separate file
    By Amarjeet Singh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2015, 05:27 AM
  2. Save each row as a separate .txt file
    By MrZorakskeep in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-06-2013, 05:03 PM
  3. [SOLVED] Save copy of each worksheet as a separate file
    By Sheepdog in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-14-2012, 01:26 AM
  4. [SOLVED] Save each row as a separate .xls file
    By janschepens in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2012, 10:51 AM
  5. Save each row as a separate .txt file
    By monsur2009 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2011, 03:50 PM
  6. Save Worksheet As A Separate File Using Cell Name
    By jasono in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-02-2011, 12:18 PM
  7. [SOLVED] How do I save each sheet as a separate .xls file by using macro?
    By Min in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2005, 10:06 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