Consulting

Results 1 to 2 of 2

Thread: Two Sheets Exported to One File

  1. #1

    Two Sheets Exported to One File

    Hi,

    I have one Excel workbook with multiple tabs.

    I'm trying to export two of them and I have a code started, but it doesn't quite work.

    Here's my code:

    Sub ExportClientVersion()
    
    
        Sheets("Client Pre-Bid Summary").Select
        Sheets("Client Pre-Bid Summary").Copy
        
        ThisWorkbook.SaveAs Filename:="C:\Users\" & Environ$("Username") & _
        "\Desktop\" & ThisWorkbook.Name & "_copy", _
        FileFormat:=xlOpenXMLWorkbookMacroEnabled
        
        Windows("New Right Size Sheet test 2.xlsm").Activate
        Sheets("Client Pre-Bid").Select
        Sheets("Client Pre-Bid").Copy After:=Workbooks("Client").Sheets(1)
    
    End Sub
    I'm attempting to save the sheets in one file saved to the users desktop as "Client" and also as an Macro Enabled workbook.

    Any ideas?

    Thanks!

  2. #2
    Hi

    Try:

    Sub ExportClientVersion()
    
        Sheets(Array("Client Pre-Bid Summary", "Client Pre-Bid")).Copy
        
        ActiveWorkbook.SaveAs Filename:="C:\Users\" & Environ$("Username") & _
        "\Desktop\" & ThisWorkbook.Name & "_copy", _
        FileFormat:=xlOpenXMLWorkbookMacroEnabled
        
    End Sub

Posting Permissions

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