Solved

VBA to Copy a worksheet to another workbook

Posted on 2016-11-08
3
65 Views
Last Modified: 2016-11-09
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
Comment
Question by:Dokat
  • 2
3 Comments
 
LVL 29

Expert Comment

by:Randy Downs
ID: 41880632
Try recording the VBA via the Developer tab while copying the table from Workbook 2015Sheet!1 Range A1:p144,031 to MergetestSheet!2015
0
 
LVL 29

Accepted Solution

by:
Randy Downs earned 500 total points
ID: 41880667
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
 

Author Closing Comment

by:Dokat
ID: 41880670
Thank you so much Randy!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now