Copoy between 2003 to 2007

jag108

Active Member
Joined
May 14, 2002
Messages
433
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Hi Guys my search could not find anything that covers the issue I am having.

Trying to copy a range from one work book (source 2003) to a new worksheet in an Excel 2007 workbook although this work book is still an xls format workbook. I originally was copying the sheet but because there is a difference in version for obvious reasons this failed, so I adjusted my code to use ranges, but now I am getting error 1004, not matter what I try.

First attempt -
Code:
    Set src_bk = ActiveWorkbook
    Set src_sht = ActiveSheet
    
    Set dst_bk = Workbooks("Destination.xls")
    If ActiveWorkbook.Name <> dst_bk.Name Then dst_bk.Activate
    
    Set dst_sht = Worksheets.Add
    dst_sht.Name = "Destination - " & Format(Now(), "mmm dd")
    
    src_bk.Activate
    With src_sht
        lrow = .Cells(.Rows.Count, "A").End(xlUp).Row
        lcol = .Cells(9, .Columns.Count).End(xlToLeft).Column
    End With

    Set src_rng = Workbooks(src_bk.Name).Worksheets(src_sht.Name).Range(Cells(1, lrow), Cells(lrow, lcol))
    Set dst_rng = Workbooks("Destination.xls").Worksheets(dst_sht.Name).Range("A1")
    src_rng.Copy dst_rng
    src_bk.Close

second attempt -

Code:
 Set src_rng = Range(Cells(1, lrow), Cells(lrow, lcol))
    src_rng.Select
    Selection.Copy
    Workbooks("Destination.xls").Activate
    dst_sht.Activate
    Range("A1").Select
    ActiveSheet.Paste
    ActiveWindow.Close

But no matter what I do I get error 1004.

Thanks in advance
 
Last edited by a moderator:

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,215,235
Messages
6,123,782
Members
449,123
Latest member
StorageQueen24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top