Solved

VBA to Copy a worksheet to another workbook

Posted on 2016-11-08
3
58 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Modern/Metro styled message box and input box that directly can replace MsgBox() and InputBox()in Microsoft Access 2013 and later. Also included is a preconfigured error box to be used in error handling.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
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.

705 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

19 Experts available now in Live!

Get 1:1 Help Now