PDA

View Full Version : [SOLVED:] Copy worksheets



ed123
07-21-2005, 08:32 AM
Having not used VBA for a while I am struggling to get back into using it. I am trying to copy a selection of worksheets (all with a variety of names) and paste them into a new workbook. Hopefully this is reasonably simple but as I haven't used VBA for a while I am finding it hard to get back into. Can anyone help?

Kind regards,

Paul

Zack Barresse
07-21-2005, 08:42 AM
Hi Paul! Welcome to the board!

This can be as simple as a single line of code ...


Option Explicit

Sub CopySelectedSheetsToNewBookPlease()
ActiveWindow.SelectedSheets.Copy
End Sub

ed123
07-21-2005, 08:54 AM
Thank you - seems so simple now! Hopefully I'll get there eventually...Paul

Zack Barresse
07-21-2005, 08:58 AM
It is simple, but you need to know what you are looking for. And that can be the hard part.

You can mark your own threads solved as well Paul. By going to Thread Tools | Mark Thread Solved | Perform Action, it will preceed your thread title with "Solved: ". That way if someone with the same question looks at the threads, they can see there is a solution already provided!

Take care Paul, nice to meet you.