+ Reply to Thread
Results 1 to 2 of 2

Save sheet as new file with userform included

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-16-2010
    Location
    Holland, MI
    MS-Off Ver
    Excel 2007
    Posts
    110

    Save sheet as new file with userform included

    Hey all,
    I have a workbook where I take several of the sheets out and save them as a separate, macro enabled workbook. But, the new workbook still relies on the old workbook for the userform and modules. How do I copy the desired userforms and code to the new workbook along with the worksheets? Is that even possible?

    Thanks!
    Joel

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Save sheet as new file with userform included

    Maybe you could just delete the sheets you don't want and resave the workbook, for eaxample.

    Sub KeepSheet()
        Dim KpSh As Worksheet
        Dim sh As Worksheet
    
        Set KpSh = Sheets("KeepSheet")
    
        Application.DisplayAlerts = 0
    
        For Each sh In Sheets
    
            If sh.Name <> KpSh.Name Then
                sh.Delete
            End If
    
        Next sh
    
        ActiveWorkbook.SaveAs Filename:="C:\Users\Dave\Downloads\" & KpSh.Name & ".xlsm"
    
    End Sub

+ 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] Save data from UserForm into Sheet (how to resolve runtime errors in UserForm tutorial)
    By eighty6 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-14-2015, 07:41 PM
  2. VBA Code to save UserForm as pdf file
    By forquaidian in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2015, 03:19 AM
  3. [SOLVED] save a sheet with code on workbook_open included
    By bulina2k in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-11-2014, 04:17 PM
  4. [SOLVED] VBA to save active sheet as new file with save as option
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-14-2013, 10:54 AM
  5. [SOLVED] VBA Help need for pullout data to new sheet from Master Sheet & save as new file (UserForm
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 01-19-2013, 06:01 PM
  6. [SOLVED] UserForm Question:Is it possible to save and close a file via a userform.
    By jer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-13-2005, 08:06 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