HairyHippy
Programmer
Hi
I'm trying to move data from multiple worksheets to a new workbook using VBA. I believe I therefore have to do this from each worksheet individually. Here is the code I'm using at the moment which is incorrect:
The line that is wrong is "Windows("Book21").Activate". How do I substitute this to make Excel think it's adding the new data to the newly added work book? Or is there a far simpler way of performing this. Note the data is not always in the same place on each worksheet.
I'm trying to move data from multiple worksheets to a new workbook using VBA. I believe I therefore have to do this from each worksheet individually. Here is the code I'm using at the moment which is incorrect:
Code:
Workbooks("Old Book").Sheets("Sheet 1").Select
Rows("1:1").Select
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Workbooks("Old Book").Activate
Workbooks("Old Book").Sheets("Sheet 2").Select
Rows("3:3").Select
Selection.Copy
Windows("Book21").Activate
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
The line that is wrong is "Windows("Book21").Activate". How do I substitute this to make Excel think it's adding the new data to the newly added work book? Or is there a far simpler way of performing this. Note the data is not always in the same place on each worksheet.