+ Reply to Thread
Results 1 to 4 of 4

split a workbook to separate Excel files in Excel?

  1. #1
    Registered User
    Join Date
    11-18-2015
    Location
    qatar
    MS-Off Ver
    2010
    Posts
    61

    split a workbook to separate Excel files in Excel?

    hi
    The following VBA code can help you quickly split multiple worksheets of current workbook to separate Excel files.

    Sub Splitbook()
    'Updateby20140612
    Dim xPath As String
    xPath = Application.ActiveWorkbook.Path
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    For Each xWs In ThisWorkbook.Sheets
    xWs.Copy
    Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & xWs.Name & ".xls"
    Application.ActiveWorkbook.Close False
    Next
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    End Sub

    What code add I specify the files placed somewhere else.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,443

    Re: split a workbook to separate Excel files in Excel?

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    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



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Registered User
    Join Date
    11-18-2015
    Location
    qatar
    MS-Off Ver
    2010
    Posts
    61

    Re: split a workbook to separate Excel files in Excel?

    i am sorry
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    01-08-2016
    Location
    Cagayan De Oro City, Philippines
    MS-Off Ver
    2013
    Posts
    152

    Re: split a workbook to separate Excel files in Excel?

    Hi

    Please Login or Register  to view this content.
    The red text is giving you the same path that the current file is in so you would need to change this to something else.....
    either give a string value "C:/SomeFolder" or what would be less error prone would be to use an excel dialog box

    MSDN

    Hope this helps
    Paul S.
    Last edited by gbeats101; 01-09-2016 at 06:21 AM. Reason: wrong tags

+ 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. split excel rows into separate files
    By weedeemer in forum Excel General
    Replies: 2
    Last Post: 10-26-2015, 05:01 PM
  2. Macro Multiple excel files into one workbook as separate sheets
    By ian_a91 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-24-2014, 08:54 AM
  3. Split the excel data in worksheet to save it in two separate excel files
    By sat1591 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-20-2014, 04:52 AM
  4. VBA code to split a worksheet into separate excel files.
    By sambo24 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2013, 06:15 AM
  5. [SOLVED] Split Large Excel file to multiple excel files and possible save the files
    By EnzioL in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-20-2012, 03:28 AM
  6. Macro to Split Workbook into separate Files
    By hkn4 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-11-2012, 11:26 AM
  7. Open Excel files in separate sessions, not just separate windows?
    By Bob at Dexia Design in forum Excel General
    Replies: 1
    Last Post: 10-18-2005, 01:05 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