PDA

View Full Version : Two Sheets Exported to One File



nirvehex
11-10-2014, 01:43 PM
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!

lecxe
11-11-2014, 08:54 AM
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