+ Reply to Thread
Results 1 to 2 of 2

Copy paste between two opened workbook

  1. #1
    Registered User
    Join Date
    07-01-2014
    Location
    Kolkata
    MS-Off Ver
    2013
    Posts
    28

    Copy paste between two opened workbook

    Hi

    CODE:

    Sub AddNewFactoryMat1()
    On Error GoTo Error_Found:
    Dim x As Workbook
    Dim y As Workbook
    Dim DstRng1 As Range
    Set x = ActiveWorkbook
    Set y = Workbooks.Open("D:\RECBOOK.xlsm")
    Set DstRng1 = y.Sheets("RecBook").Cells(Rows.Count, 4).End(xlUp).Offset(1, 0)
    Set ws = x.Sheets("New MetStk Input")
    Application.ScreenUpdating = False
    Set SrcRng1 = ws.Range("Ad_Mat_Rec1")
    SrcRng1.Copy
    DstRng1.PasteSpecial xlPasteValues
    Application.ScreenUpdating = False
    End If
    Exit Sub
    Error_Found:
    MsgBox " Opps, something has gone bottoms up"
    End Sub

    two workbook are Forms.xlsm and RECBOOK.xlsm. Macro will run from Forms.xlsm. Problem is hear two workbooks are already open.
    it is asking to open RECBOOK.xlsm while it already opened.

    Want to do copy and paste as much as user wish and SAVE RECBOOK.xlsm workbook on Exit
    Please Help

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Copy paste between two opened workbook

    If you have both workbooks open every time you run this macro, I don't think you need this line...
    Please Login or Register  to view this content.
    comment it out then run the macro and see what happens.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA to copy cell from opened or closed workbook into another workbook
    By megtoma in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2014, 04:22 PM
  2. [SOLVED] Copy a Worksheet from a Closed Workbook to the Current Opened Workbook
    By glennchung in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-28-2014, 12:55 PM
  3. Use a macro to extract cell data from opened workbook to new opened workbook
    By BrianTFC in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-26-2014, 01:35 PM
  4. Replies: 0
    Last Post: 04-26-2013, 03:40 AM
  5. Need to Copy Columns from Previous Workbook to Newly Opened Workbook
    By BYizz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-06-2012, 06:33 AM
  6. VBA button to store data from 1 workbook and paste it in another UN-opened workbook
    By mountaineerhughes in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-26-2012, 11:39 AM
  7. Copy/paste from file opened by macro
    By Drunk_Masta in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-17-2008, 04:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1