Hi everyone,
I'm having trouble with my VBA code.
I have about 15 sheets in my workbook, but I want to export 5 sheets to a new workbook with the click of a button and save it in the same directory as the existing workbook.
The button part is easy. I looked up something for the exporting, but it isn't working properly.
Can someone gives me some tips?
This is what I got so far, I didn't use the actual names of the sheets.
Sub Export_Sheets()
Dim wb As Workbook
Sheets("Example").Copy
Sheets("Example2").Copy
Sheets("Example3").Copy
Sheets("Example4").Copy
Sheets("Example5").Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Path & "\New Workbook.xlsx"
End With
End Sub
I'm looking forward to your awnsers!
- Daan
Bookmarks