I need to open a workbook(A) from within another workbook(B) and copy the contents of three sheets of workbook(A) into specified sheets of workbook(B)
To do this I have written the following code:-
Sub FillBudget(NewYr)
BudgetName = "Budget " & NewYr & ".xlsm"
Dim wbBudget As Workbook
Dim wbdata As Workbook
Set wbdata.Name = BudgetName
Set wbBudget.Name = "Test45.xlsm" ***************
Workbooks(wbdata).Activate
ActiveWorkbook.Sheets("TapeBudget").Range("A1:M54").Copy Workbooks(wbBudget).Sheets("TapeBudget").Range("A1")
ActiveWorkbook.Sheets("LabelBudget").Range("A1:M54").Copy Workbooks(wbBudget).Sheets("LabelBudget").Range("A1")
ActiveWorkbook.Sheets("AllBudget").Range("A1:M54").Copy Workbooks(wbBudget).Sheets("AllBudget").Range("a1")
End Sub
This code fails at the line marked******** with the error message "Invalid use of property". I have tried several variations of this code without success and need some help please.
John
Bookmarks