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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
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,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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