Copy and Paste Problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to copy and paste the following cells:

Copy cells A1:x5 from the Work Schedule tab and paste to cells A1:X5 on the
Overtime tab

Copy cells D6:D35 from the Work Schedule tab and paste to the cells D15:X44
on the Overtime tab

I created a button with the following code but get a run-time error 438

Sheets("Work Schedule").Range("A1:X5").COPY
Sheets("Overtime").Range("a1:X5").Paste
Sheets("Work Schedule").Range("D6:X35").COPY
Sheets("Overtime").Range("D15:x44").Paste
 
Anna,

Try passing the destination to the call to Copy. For example:

With Sheets("Work Schedule")
.Range("A1:X5").Copy Sheets("Overtime").Range("a1:X5")
.Range("D6:X35").Copy Sheets("Overtime").Range("D15:x44")
End With
 
It don't like the Paste. Try this and watch the word wrap on the newsreader.
There should be only two lines.

Sheets("Work Schedule").Range("A1:X5").COPY Sheets("Overtime").Range("A1:X5")
Sheets("Work Schedule").Range("D6:X35").COPY
Sheets("Overtime").Range("D15:X44")
 
Thank you both very much.

Vergel Adriano said:
Anna,

Try passing the destination to the call to Copy. For example:

With Sheets("Work Schedule")
.Range("A1:X5").Copy Sheets("Overtime").Range("a1:X5")
.Range("D6:X35").Copy Sheets("Overtime").Range("D15:x44")
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top