VBAProIWish
Well-known Member
- Joined
- Jul 6, 2009
- Messages
- 1,027
- Office Version
- 365
- Platform
- Windows
Hello All,
The code below copies data from the "2011-03 Green" workbook and pastes it into the "Tea" workbook.
How can I tell the macro to go back to the original workbook which will have a different name every month I run this macro?
For example...THIS month it's "2011-03 Green", but next month the workbook will be named "2011-04 Green"
Thanks much!
The code below copies data from the "2011-03 Green" workbook and pastes it into the "Tea" workbook.
How can I tell the macro to go back to the original workbook which will have a different name every month I run this macro?
For example...THIS month it's "2011-03 Green", but next month the workbook will be named "2011-04 Green"
Code:
Sub aaa_test_macro
Dim Rng As Range
Set Rng = Range("a1").CurrentRegion
Set Rng = Rng.Offset(1, 0)
Set Rng = Rng.Resize(Rng.Rows.Count - 1)
Rng.Copy
Windows("Tea.xlsm").Activate
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
How can I change the line below to go to the previously activated workbook?
[B][COLOR=red]Windows("2011-03 Green.xlsm").Activate[/COLOR][/B]
End Sub
Thanks much!