+ Reply to Thread
Results 1 to 3 of 3

Export Specific Area of Data into new Workbook

Hybrid View

  1. #1
    Registered User
    Join Date
    09-21-2023
    Location
    California
    MS-Off Ver
    16.77.1 Excel (365)
    Posts
    11

    Export Specific Area of Data into new Workbook

    hello,

    I have 8 separate worksheets that have data and once every month i send each sheet to a separate person. Is there an easy way to export the information sheet by sheet to new individual workbooks as I don't want them seeing each others information?

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Export Specific Area of Data into new Workbook

    Please see post#3 for a better version...

    Hi stdar2 - Try this:
    Sub Save_Sheets()
      Dim w, n
      w = Split("Sheet1,Sheet2,Sheet3,Sheet4", ",")
      n = Split("name1,name2,name3,name4", ",")
      For i = 0 To UBound(w)
          ThisWorkbook.Worksheets(w(i)).Copy
          ActiveWorkbook.Close SaveChanges:=True, Filename:="C:\Users\YOUR_USER_NAME_HERE\Desktop\" & n(i) & ".xlsx"
      Next
    End Sub
    Obviously, you'll have to adjust all the names, as well as the destination.
    Last edited by leelnich; 10-25-2023 at 02:37 PM. Reason: Wrote better version (Post#3)
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Export Specific Area of Data into new Workbook

    After further testing: this example overwrites old versions of each workbook automatically (if such exist).
    Sub Save_Sheets2()
      Dim w, n
      w = Split("Sheet1,Sheet2,Sheet3,Sheet4", ",")                   'Worksheet names
      n = Split("bookname1,bookname2,bookname3,bookname4", ",")       'New workbook names
      
      Application.DisplayAlerts = False
      Application.ScreenUpdating = False
      
      For i = 0 To UBound(w)
          ThisWorkbook.Worksheets(w(i)).Copy
          With ActiveWorkbook
            .ConflictResolution = xlLocalSessionChanges
            .Close SaveChanges:=True, Filename:="C:\Users\YOUR_USER_NAME_HERE\Desktop\" & n(i) & ".xlsx"
          End With
      Next
      
      Application.DisplayAlerts = True
      Application.ScreenUpdating = True
    
    End Sub
    Last edited by leelnich; 10-25-2023 at 03:56 PM. Reason: Added comments

+ 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. [SOLVED] Copy specific area with filled cells (range) to another worksheet within the same workbook
    By NewBee_HS in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-18-2022, 10:49 AM
  2. [SOLVED] Export SPECIFIC worksheet from workbook.
    By Efeid in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-12-2018, 12:19 PM
  3. Replies: 4
    Last Post: 02-14-2017, 11:21 AM
  4. Export/ Retrieve specific data from multiple workbooks and Import into Master workbook
    By SerenitynWisdom in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-29-2013, 10:41 PM
  5. I would need a macro to export data from base example workbook to export worbook
    By slato8 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2012, 11:21 AM
  6. Export specific print page to new workbook?
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-06-2012, 09:52 PM
  7. Dynamic data - Export area
    By tonkpils in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-24-2008, 10:34 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