Copy multiple sections using VBA getting Run Time error 450

Parzival

New Member
Joined
Apr 8, 2018
Messages
3
Hello,
I can't figure out why i'm getting a run time error here.

This works just fine
Code:
lastrow = Cells(Rows.Count, "A").End(xlUp).RowActiveSheet.Range("AQ4:AZ" & lastrow, "BR4:CR" & lastrow).Copy

But for some reason when I add three ranges (example below) it gives me the run time error 450
"Wrong number of arguments or invalid property assignment"

Code:
ActiveSheet.Range("M4:V" & lastrow, "AQ4:AZ" & lastrow, "BR4:CR" & lastrow).Copy

Any help with this issue will be greatly appreciated!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
If you want to copy 3 different ranges try
Code:
ActiveSheet.Range("M4:V" & lastrow & ",AQ4:AZ" & lastrow & ",BR4:CR" & lastrow).Copy
 
Upvote 0
Thank you so much! I don't know why it allows two sections, but requires putting some of the code into the text in order to allow more but it worked. I was able to get all 5 of my sections added using your method!

Thanks again!
 
Upvote 0
Glad to help & thanks for the feedback.

FYI this line of code
Code:
ActiveSheet.Range("AQ4:AZ" & lastrow, "BR4:CR" & lastrow).Copy
will actually copy AQ4:CR & lastrow, rather than AQ:AZ & BR:CR
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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