I'm new to Visual Basic on Excel and I've been struggling trying to copy one cell to another on a different sheet. For example, if Sheet1
has the following:
Animal Owner
Dog John
Cat Gabe
And Sheet2
is simply blank, assuming Animal
and Owner
are in different columns and are in columns A
and B
respectively, I just wanted to copy Dog
into A2 (Animal is in cell A1) onto sheet two, for example.
I tried to look things up online and tried:
Dim dataSheet As Worksheet
Set dataSheet = ThisWorkbook.Sheets("Sheet1")
Dim DestinationSheet As Worksheet
Set DestinationSheet = ThisWorkbook.Sheets("Sheet2")
dataSheet.Range("A2").Copy DestinationSheet.Range("A2")
But I keep getting an error saying that:
Run-time error '1004': Method 'Range' of object '_Worksheet' failed.
I just want to copy from one cell to another onto a different worksheet. If anyone has any idea to do so, that would be great! Thanks!