Forum Discussion
Poly2021
Sep 29, 2021Copper Contributor
VBA macros for copy and pasting files from one workbook to another
Hi Team, I'm new with VBA macros and I'm struggling with completing a macro code to automate the copy and pasting of data from one workbook to another. I think I got the code for copying, but I'm...
HansVogelaar
Sep 29, 2021MVP
It could look like this:
Sub CopyData()
Dim wbkSource As Workbook
Dim wbkTarget As Workbook
Set wbkSource = Workbooks.Open("Source File.xlsx")
Set wbkTarget = Workbooks.Open("Destination File.xlsx")
wbkSource.Worksheets("Apple").Range("A1").Copy _
Destination:=wbkTarget.Worksheets("Banana").Range("A1")
Application.CutCopyMode = False
End Sub- Poly2021Sep 29, 2021Copper ContributorThanks. I will try this one tomorrow. Its late now here in my place. I really appreciate this a lot.