Error 400 on copy and paste VBa code

michelangelo

New Member
Joined
Nov 23, 2016
Messages
6
I am trying to run a copy and paste code for a much larger marco that has a repeated copy and paste code. I get the 400 error with the lines of code idicated in bold (i have sepereately gone through lines checking!). Any and all help muhc appreicated!

Sub copy()

Dim TestRange As Range
Dim Pasterange As Range
Dim row As Integer
Dim newrow As Integer
Dim start As Integer
Dim finish As Integer
Dim sht As Worksheet
row = 1
start = 5
finish = 9
newrow = 2


Set sht = ThisWorkbook.Worksheets("Test")
sht.Select
ActiveSheet.Cells(row, start).Select
Set TestRange = Selection
Range("TestRange").Resize(1, 5).Select

ActiveSheet.Cells(newrow, start).Select
Set Pasterange = Selection
Range("TestRange").copy
Range("Pasterange").Paste

End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try this.
Code:
ActiveSheet.Cells(newrow, start).Select
Set Pasterange = Selection
TestRange.copy
Pasterange.Paste
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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