Copy / Paste error 1004

mps

New Member
Joined
Feb 7, 2011
Messages
42
Using VBA I am trying to open another excel workbook and copy a selection from the current workbook to this opened workbook and then close it.

Things were working ok, but now it keeps producing an error on trying to paste the selection to the opened workbook. (Red line in the code below) It says:

runtime error 1004
That command cannot be used on multiple selections

As far as I can see I don't have mutiple selections. Any ideas of what I am doing wrong??

Code:
Set wkbtaxclass = Workbooks.Open(taxfname)
If wkbtaxclass.ReadOnly = True Then wkbtaxclass.Close: GoTo tryagain12 
wkbtaxclass.Sheets(1).Cells.Delete
wkbtaxclass.Sheets(1).Activate
Sheet7.Range("B10:C1000").Copy
wkbtaxclass.Sheets(1).Range("A1").Select

[COLOR=red]wkbtaxclass.Sheets(1).Paste
[/COLOR]
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Does this work?

Code:
Sheet7.Range("B10:C1000").Copy Destination:=wkbtaxclass.Sheets(1).Range("A1")
 
Upvote 0
Thanks VoG that works perfectly! Just so I can learn something: Is there a reason why your code works but mine crashed???
 
Upvote 0
I'm not sure why yours crashed but generally it is a good idea to avoid selecting anything. Selecting is rarely required.
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,519
Members
452,921
Latest member
BBQKING

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