![]() |
Copy range without changing sheet in view?
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! -- Message posted from http://www.ExcelForum.com |
Copy range without changing sheet in view?
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) "William DeLeo " wrote in message ... Greetings, I need to use a macro to copy cell values from one sheet to another without changing the sheet that's in view. I have been using the following code but my selection method causes the sheet in view to flip back and forth between the sheet the cells are being copied from to the 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 I need the syntax to copy a range from a sheet without making it "Active". Thanks in advance!! --- Message posted from http://www.ExcelForum.com/ |
Copy range without changing sheet in view?
Try this William
Sub test() Sheets("Sheet1Name").Range("D4").Copy _ Sheets("Sheet2Name").Range("C5") End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "William DeLeo " wrote in message ... Greetings, I need to use a macro to copy cell values from one sheet to another without changing the sheet that's in view. I have been using the following code but my selection method causes the sheet in view to flip back and forth between the sheet the cells are being copied from to the 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 I need the syntax to copy a range from a sheet without making it "Active". Thanks in advance!! --- Message posted from http://www.ExcelForum.com/ |
Copy range without changing sheet in view?
As easy as that is, I was having trouble figuring out the syntax.
I appreciate your help very much. Thank you -- Message posted from http://www.ExcelForum.com |
Copy range without changing sheet in view?
I see that you are not using the Paste command at all ... how would you
advice apply if I were using paste special -- Message posted from http://www.ExcelForum.com |
Copy range without changing sheet in view?
Use something like this
Sub test() Sheets("Sheet1Name").Range("D4").Copy Sheets("Sheet2Name").Range("C5").PasteSpecial xlPasteValues, , False, False Application.CutCopyMode = False End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "William DeLeo " wrote in message ... I see that you are not using the Paste command at all ... how would your advice apply if I were using paste special? --- Message posted from http://www.ExcelForum.com/ |
Copy range without changing sheet in view?
|
All times are GMT +1. The time now is 08:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com