Friday, 31 August 2012

Excel VBA Macro To Add, Open, Save A Workbook

Macro To Add, Open, Save A Workbook
Sub Add_Workbook()
Workbooks.ADD.SaveAs Filename:="C:\Documents and Settings\Administrator\My Documents\Test.xlsx" 'Creates A Workbook
Workbooks("A").Worksheets("AAA").Range("A1:Z65000").Copy

Workbooks.Open Filename:="C:\Documents and Settings\Administrator\My Documents\Test.xlsx" 'Opens An Existing Workbook
Workbooks("Test").Activate
Workbooks("Test").Worksheets("sheet1").Range("a1").PasteSpecial
Workbooks("Test").Save
Workbooks("Test").Close
End Sub

No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts