Adding new workbook!

A

aiyer

Hi all!

A quick question.
I wanted to add a new workbook(book1 is default) and copy all th
columns/rows from the existing workbook (vtec.sls) to the new one.
After that I would like to manipulate the new workbook(book1), withou
changes to the original one and I would like to do this multipl
times.
I.e., the next workbook to be added would be book3 and then book 4 an
so on.... But before book3 is added, book2 has to be closed withou
saving the changes.
I was wondering how to implement this using macros and would appreciat
any help guys.


Thanks alot.
Arun...
Vtec corp
 
M

mudraker

a couple of examles on how to do it once.

You would need to repeat code for multiple times or inclose in a FO
loop



Sub Macro1()
Dim wsData As Worksheet
Set wsData = ActiveSheet

Workbooks.Add
wsData.Cells.Copy
ActiveSheet.Paste

'your manipulation code here

ActiveWindow.Close savechanges:=False

End Sub

Sub Macro2()
Dim wsData As Worksheet
Set wsData = ActiveSheet

Workbooks.Add
wsData.Copy Before:=ActiveWorkbook.Sheets(1)
'your manipulation code here
ActiveWindow.Close savechanges:=False
End Su
 
Top