Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

macro to copy data from work book a and paste to workbook b

Posted on 2014-01-10
3
Medium Priority
?
344 Views
Last Modified: 2014-01-10
Hi Expert's excel 2007

I need a macro to copy data from work book a which will be open when running the macro...to copy and paste special all into work book b at file path :"\\hfhjyukkgt\gjutjkk\workbook b.xlsx

data range a1:gg15000 workbook a

and paste the data into sheet Master cell a1...then close work book b down..

then the next time work book a is open delete the existing data and replace with the new data from wrk a when macro is re run
0
Comment
Question by:route217
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 53

Accepted Solution

by:
Rgonzo1971 earned 1000 total points
ID: 39770805
Hi,

pls try

Sub Macro()
Set SrcWbk = ActiveWorkbook
Set SrcSht = SrcWbk.ActiveSheet
Set DestWbk = Workbooks.Open("YourFile")
DestWbk.Worksheets("Master").Cells.Delete
SrcSht.Range("A1:GG15000").Copy
DestWbk.Worksheets("Master").Range("A1").PasteSpecial xlPasteAll
DestWbk.Close xlSaveChanges
End Sub

Open in new window

Regards
0
 
LVL 27

Assisted Solution

by:MacroShadow
MacroShadow earned 1000 total points
ID: 39770860
Alternatively, try this:

Sub Demo()

    Dim wbDestination As Workbook
    Dim rngSource As Range
    Dim rngDestination As Range

    Set wbDestination = Workbooks.Open("\\hfhjyukkgt\gjutjkk\workbook b.xlsx")
    Set rngSource = ActiveSheet.Range("A1:GG15000")
    Set rngDestination = wbDestination.Sheets("Master").Range("A1:GG15000")

    rngDestination.Clear

    rngDestination.Value = rngSource.Value

    wbDestination.Close

End Sub

Open in new window

0
 

Author Closing Comment

by:route217
ID: 39771294
Excellent feedback
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

636 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