• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 101
  • Last Modified:

VBA to Copy a worksheet to another workbook

Good Afternoon Everyone,

I have two workbooks where i want Excel to automatically update the table in one sheet based on the other one.
i want the table in workbook MergetestSheet!2015 to automatically update based on the table in workbook 2015Sheet!1 Range A1:p144,031. Can someone help with the VBA code?

Thanks
0
Dokat
Asked:
Dokat
  • 2
1 Solution
 
Randy DownsOWNERCommented:
Try recording the VBA via the Developer tab while copying the table from Workbook 2015Sheet!1 Range A1:p144,031 to MergetestSheet!2015
0
 
Randy DownsOWNERCommented:
I created a macro by recording my copy and ended uo wit hthe following. You will want your range to cover your entire table & this macro assumes both files are open.

Sub Macro2()
'
' Macro2 Macro
'

'
    Windows("workbook 2015.xlsx").Activate
    Range("A2:O41").Select

    Range("Table1").Select
    Selection.Copy
    Windows("MergetestSheet.xlsx").Activate
    Range("A2").Select
    ActiveSheet.Paste

End Sub

Open in new window

0
 
DokatAuthor Commented:
Thank you so much Randy!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now