VBA Copy range

jakobt

Active Member
Joined
May 31, 2010
Messages
337
In a current workbook. Want to copy a range to another workbook. Error message: Compile error: .Copy Method or member not found?

Sub Select_current_region()


Range("A1:I132").Select
Selection.Copy Destination:=Workbooks("AB Europe Gmbh - BS Rec Sep.xlsm").Worksheets("TB Sep").Range("A1")




End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hello,

There is no need to use Select ...

You just have to make sure all of your spellings are correct ...
and that the destination workbook is not closed ...

Code:
[COLOR=#333333]Sub Select_current_region()[/COLOR]
[COLOR=#333333]Range("A1:I132")[/COLOR][COLOR=#333333].Copy Destination:=Workbooks("AB Europe Gmbh - BS Rec Sep.xlsm").Worksheets("TB Sep").Range("A1")[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
 
Upvote 0
Check your spellings. I just tested it by creating a workbook and worksheet with those names and it worked fine (ensuring the workbook is open)

Also you can do that in 1 line. Using selection is rarely a good option

Code:
Range("A1:I132").Copy Destination:=Workbooks("AB Europe Gmbh - BS Rec Sep.xlsm").Worksheets("TB Sep").Range("A1")
 
Upvote 0
It says run time error 9: Subscript out of range.

As stated previously by gallen and myself ... your spellings are not absolutely identical ... !!!

The " Run time error 9 : subscript out of range" ... says it all ... :wink:
 
Upvote 0
Just to add to what James006 has stated, check your spaces are correct and also that you haven't got a leading or trailing space in both your Workbook and Sheet name.
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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