Copy range without changing sheet in view?

  • Thread starter Thread starter William DeLeo
  • Start date Start date
W

William DeLeo

Greetings,

I need to use a macro to copy cell values from one sheet to anothe
without changing the sheet that's in view. I have been using th
following code but my selection method causes the sheet in view to fli
back and forth between the sheet the cells are being copied from to th
one they are being pasted on.

I am using the follwing:

Sheets("Sheet1Name").Select
Range("D4").Select
Selection.Copy

Sheets("Sheet2Name").Select
Range("C5").Select
ActiveSheet.Paste

How can I rewrite this to do all the work in the background? I guess
need the syntax to copy a range from a sheet without making i
"Active".

Thanks in advance!
 
Sheets("Sheet1Name").Range("D4").Copy Destination:= _
Sheets("Sheet2Name").Range("C5")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Try this William

Sub test()
Sheets("Sheet1Name").Range("D4").Copy _
Sheets("Sheet2Name").Range("C5")
End Sub
 
As easy as that is, I was having trouble figuring out the syntax.

I appreciate your help very much. Thank you
 
I see that you are not using the Paste command at all ... how would you
advice apply if I were using paste special
 
Use something like this


Sub test()
Sheets("Sheet1Name").Range("D4").Copy
Sheets("Sheet2Name").Range("C5").PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
End Sub
 

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