Sub r()
Dim wb As Workbook
Set wb = Workbooks.Open(Workbooks("SpecificWorkbook.xlsx")
wb.Sheets("Specific").Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
wb.Close
End Sub
Little confused now.
That sounds like you want to open two other workbooks, the TEMPLATEWORKBOOK and another workbook.
You then want to copy a sheet, TEMPLATEWORKSHEET to the other workbook that was opened.
Is that correct or am I missing something?
Thanks!
Can you explain a bit please:
I assume wb is a variable.
Which of the rest words like Workbook, Workbooks, ThisWorkbook are builtin variables and not user-defined variables?
Can you go through each word please to explain?
For example:
Dim wb as Workbook : I understand that you set a variable named wb to be Workbook, so is Workbook a built in name for the type/class of variable for workbooks?
Then you set wb to open SpecificWorkbook but what does the Workbooks word mentioned twice mean?
Then you copy the Specific sheet from the workbook wb, into ThisWorkbook. What is the ThisWorkbook? is it builtin variable for the active workbook?
This will help me very much,
Thanks!
Sub r()
Dim wb As Workbook [COLOR=#008000]'Declare object [/COLOR][COLOR=#008000]variable[/COLOR]
Set wb = Workbooks.Open(Workbooks("SpecificWorkbook.xlsx") [COLOR=#008000]'Initialize object variable[/COLOR]
wb.Sheets("Specific").Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count) [COLOR=#008000]'Copy sheet from opened wb to active workbook.[/COLOR]
wb.Close [COLOR=#008000]'Close opened workbook. Add 'False' to statement to prevent alert message.[/COLOR]
End Sub