I want to programmatically copy three ranges from one spreadsheet and paste those ranges into the same cell addresses of another spreadsheet. The code for copying the ranges looks like this:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
<o></o>
<o></o>
This successfully puts the three ranges on the clipboard. My problem has been creating a macro on the spreadsheet to be pasted that would paste each range into the corresponding cells. Specifically, I don't know how to tell clipboard to paste this clipboard item here and that clipboard item there. <o></o>
<o></o>
It is important that Range O16:W1289 of the copied spreadsheet be pasted in range O16:W1289 of the receiving spreadsheet. Thus, I need clipboard to be able to distinguish between the three. I was hoping that clipboard might do this by the order that items were copied, but I can't seem to get that working. <o></o>
<o></o>
Here's a sample of what I have tried on the receiving spreadsheet:<o></o>
<o></o>
<o></o>
<o></o>
I get a range error. I'm confident that the problem is that I'm not telling VBA which of the three items on the clipboard it should paste. How do I tell it that?<o></o>
<o></o>
Thank you in advance.<o></o>
<o></o>
Rich (BB code):
Sub Button256_Click()
Range("O16:W1289").Copy
Range("Z16:AG1289").Copy
Range("AK16:AR1289").Copy
End Sub
<o></o>
This successfully puts the three ranges on the clipboard. My problem has been creating a macro on the spreadsheet to be pasted that would paste each range into the corresponding cells. Specifically, I don't know how to tell clipboard to paste this clipboard item here and that clipboard item there. <o></o>
<o></o>
It is important that Range O16:W1289 of the copied spreadsheet be pasted in range O16:W1289 of the receiving spreadsheet. Thus, I need clipboard to be able to distinguish between the three. I was hoping that clipboard might do this by the order that items were copied, but I can't seem to get that working. <o></o>
<o></o>
Here's a sample of what I have tried on the receiving spreadsheet:<o></o>
<o></o>
Rich (BB code):
Sub Button255_Click()
Range("O16").Select<o:p></o:p>
Selection.PasteSpecial Paste = xlPasteValues<o:p></o:p>
End Sub
<o></o>
I get a range error. I'm confident that the problem is that I'm not telling VBA which of the three items on the clipboard it should paste. How do I tell it that?<o></o>
<o></o>
Thank you in advance.<o></o>