copy range from one excel app to the other getting subscript out of range error

thechazm

New Member
Joined
Mar 26, 2013
Messages
14
It seems there is a problem copying from one excel applications worksheet to another excel applications worksheet through vba. I am opening two excel applications (not the same instance) and am trying to copy a single range of just values no formats and I keep getting errors. I have narrowed it down to it being two seperate excel applications but how can I overcome this problem? I can get this to work if I open the other workbook in the same excel instance but not if it is a seperate one. Below is experimental code:

Opening in seperate instance copying a range but converts even though only using .value

Code:
xlsModify.Range("A1").Value = xlsRemoteSheet.Range("A1:AL1").Value

Opening it in the same instance I can get it to copy using the copy function that does not convert values (like numbers to dates or whatever)

Code:
xlsRemoteSheet.Name.Range("A1:AL1").Copy xlsModify.Name.Range("B1")

If anyone could shed some light on this for me I would greatly appreciate it. Also as a side note I notice when you use the .value to copy over the data it also copies any named ranges if the range in the remote worksheet had a named range into the original one :/

I thought the .value just pulls over the value but it's not.

Thanks
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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