1

I am trying to set up a command button that will copy and paste data from one sheet to another.

Currently my code looks like this:

Private Sub CommandButton1_Click()

ThisWorkbook.Sheets("Raw Data").Activate

ThisWorkbook.Sheets("Data AC").Range("A1:J1000").Select
Selection.Copy
ThisWorkbook.Sheets("Raw Data").Range("A2:J1001").Select
Selction.Paste


End Sub

I keep getting an error saying 'select method of range class failed', but cannot work out how to fix it. Thanks

Josie
  • 71
  • 7
  • Don't use the clipboard for a simple copy action, the clipboard is a user resource that must be preserved. **Hint**: take a look at `Range().Copy()` method. – PA. Dec 02 '15 at 14:34

1 Answers1

2

Try this:

Private Sub CommandButton1_Click()

ThisWorkbook.Sheets("Raw Data").Activate

Sheets("Data AC").Range("A1:J1000").Copy Sheets("Raw Data").Range("A2:J1001")


End Sub
manu
  • 942
  • 8
  • 17