Hello all,
I am currently writing macros that will transfer data from a template file, to what is essentially a log file. How does one go about copying data from one workbook to another. I have currently been able to transfer data from one sheet to another using the following code:
Sub TestMacro3()
'
' TestMacro2 Macro
'
'
Range("B1").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("MONTHLY REPORT").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=YEAR(TODAY())"
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub
How could I get this code to write to another workbook. I believe that I read in order to paste another file it must be opened. Is that correct? Any help would be much appreciated.
Thanks,
Scott
Moderator's note: code tags added for you
Bookmarks