Results 1 to 6 of 6

Copy/Paste to another workbook

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-01-2016
    Location
    Prague
    MS-Off Ver
    2013
    Posts
    121

    Copy/Paste to another workbook

    Hi Everyone,

    I managed to write a macro to do the copy paste from one workbook to another. But somehow, its giving the stupid red error ! "Subscript out of range"

    I sware I checked the location 12314 times.

    And the file is already open, since the macro button is on that file in the first place.

    Any has any idea, what is the reason ?

    Thanks a lot
    Orhan


    Sub copy_paste()
    
    Dim x As Workbook
    Dim y As Workbook
    Dim ws1 As Worksheet
    
    Application.ScreenUpdating = False
    
    Set x = Workbooks.Open("\\ant\dept-eu\PRG10\HR\prg10-eu-hr-services\T2-ZA\2. Extended Onboarding\3. Tracker\HRS TEST.xlsx")
    
    Set ws1 = x.Sheets("Manual Data Shared File")
    
    ws1.Select
    Rows("1:9999").Select
    Selection.Delete Shift:=xlUp
    
    Windows("\\ant\dept-eu\PRG10\HR\prg10-eu-hr-services\T2-ZA\2. Extended Onboarding\3. Tracker\a.XLSM").Activate
    
    Worksheets("Data").Activate
         
     Range("A1:CX2000").Select
        Application.CutCopyMode = False
        Selection.Copy
        
    Windows("\\ant\dept-eu\PRG10\HR\prg10-eu-hr-services\T2-ZA\2. Extended Onboarding\3. Tracker\HRS TEST.xlsx").Activate
        
        Sheets("Manual Data Shared File").Select
       Range("A1:CX2000").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        
        
    End Sub
    Last edited by orhanceliloglu; 03-08-2018 at 12:02 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 02-16-2018, 06:40 PM
  2. [SOLVED] VBA Macro pull a certain cell in closed workbook and copy/paste into current workbook
    By Hoover5896 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2017, 01:36 AM
  3. [SOLVED] VBA - Excel code to copy and paste from several Sharepoint workbook files to one workbook
    By TraceyPatterson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2015, 06:45 AM
  4. [SOLVED] Macro to find data in source workbook and copy paste to target workbook
    By D.Lovell in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-23-2014, 06:21 AM
  5. Replies: 6
    Last Post: 03-26-2014, 11:40 PM
  6. Open workbook, filter values, copy/paste into Active workbook.
    By niceguy21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2013, 12:17 PM
  7. Copy and paste non consecutive cells and paste consecutively in another workbook
    By macquhele in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-12-2011, 02:36 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