Open Workbook,Copy Sheet,Move Sheet, Close/Save
With the code I have, if I comment out the Open and the Close/Save code it will make a copy of the sheet and move it to the right workbook, but if I dont comment it out it wont. It will open,close, and save but without the sheet copied and moved.I need it to open a workbook, make a copy of a sheet from a different workbook, move the copied sheet to the NEW workbook, then save and close the new workbook. Any ideas? Also, how could I copy, move, save, and close specific columns (F,G,and H)?
Sub Copier1()
'Opens workbook
Workbooks.Open "C:\Documents and Settings\pruss\My Documents\NEW.xls" '
'Makes a copy of "Sheet1"
ActiveWorkbook.Sheets("Sheet1").Copy _
after:=ActiveWorkbook.Sheets("Sheet1")
'Moves that copy to "NEW.xls" workbook
ActiveSheet.Move Before:=Workbooks("NEW.xls").Sheets(1)
ActiveSheet.Next.Select
'Closes "NEW.xls" workbook and saves the copied sheeet
ActiveWorkbook.Close SaveChanges:=True
End Sub
Thanks,
|