I am simply trying to copy one range on a worksheet to another range on a different worksheet. From what I understand the method is Range1.Copy(DestRange) Do I need to specify the worksheets, like this? Worksheets("sheet1").Range1.Copy(Worksheets("Destination").DestRange)
My code throws an error: Runtime Error 1004: Method 'Copy' of Object 'Range' failed
My Code:
Sub adsadsf()
Dim currentR As Range
Dim rawIput As Worksheet
Dim excitationWs As Worksheet
Set currentR = Range("B2", Range("B2").End(xlDown))
currentR.Select
Set rawInput = Worksheets("rawInput")
Set excitationWs = Worksheets("Excitation Curve")
'none of these work. all throw same error
'currentR.Copy (Range("H1"))
'currentR.Copy (Range("H1"))
'currentR.Copy (excitationWs.Range("A1"))
rawInput.Copy (excitationWs.Range("A1"))
End Sub
currentR.Copy Range("H1")
without brackets. AlsorawInput.Copy (excitationWs.Range("A1"))
should berawInput.Cells.Copy excitationWs.Range("A1")
if you want to copy all cells (unefficient - better to copy sheet). This might be interesing: What is the difference between entering parameters in these four different ways – Dmitry Pavliv