Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jan 2007
    Location
    Gray, Louisiana, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Does anyone have a macro to
    1. Copy a specified worksheet in an open (Active) workbook?

    2. Save it as a new workbook, with the user being able to specify the save name, and directory prior to saving?

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try this:

    Code:
    Sub ExportSheet()
      Dim wsh As Worksheet
      Set wsh = ActiveSheet ' or: Set wsh = Worksheets("MySheet")
      wsh.Copy
      Application.Dialogs(xlDialogSaveAs).Show
    End Sub

  3. #3
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The following copies the active sheet to a new workbook and then displays the Save As dialog.

    Code:
    Sub CopySheetSaveAs()
    	ActiveSheet.Copy
    	Application.GetSaveAsFilename
    End Sub

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    GetSaveAsFilename only displays the Save As dialog, it doesn't actually save the workbook - the programmer should do that.

  5. #5
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for that - hadn't notice that the file hadn't actually saved.

  6. #6
    2 Star Lounger
    Join Date
    Jan 2007
    Location
    Gray, Louisiana, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks everyone. This is handy when placed in Personal.xls for use on any workbook.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •