Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy/ Paste Special
This line works for me: rngSource.Copy Destination:=wsTarget.Range("A2")
but I'd like to add: PasteSpecial Paste:=xlFormats, PasteSpecial Paste:=xlValues I'm not getting the syntax right. Could someone help me out please? Also, since the number of rows in my target changes, I would have preferred to use something like: rngSource.Copy Destination:=wsTarget.Range("A" & lstRow + 1) but it fails, even though I know I have defined lstRow. Thanks in advance! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy/ Paste Special
Hi,
Try this: rngSource.Copy With wsTarget.Range("A" & lstRow + 1).Resize(rngSource.Rows.Count, _ rngSource.Columns.Count) .PasteSpecial xlValues .PasteSpecial xlFormats End With Regards, KL "GettingThere" wrote in message ... This line works for me: rngSource.Copy Destination:=wsTarget.Range("A2") but I'd like to add: PasteSpecial Paste:=xlFormats, PasteSpecial Paste:=xlValues I'm not getting the syntax right. Could someone help me out please? Also, since the number of rows in my target changes, I would have preferred to use something like: rngSource.Copy Destination:=wsTarget.Range("A" & lstRow + 1) but it fails, even though I know I have defined lstRow. Thanks in advance! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy/ Paste Special
Very good KL! Thank you.
"KL" wrote: Hi, Try this: rngSource.Copy With wsTarget.Range("A" & lstRow + 1).Resize(rngSource.Rows.Count, _ rngSource.Columns.Count) .PasteSpecial xlValues .PasteSpecial xlFormats End With Regards, KL "GettingThere" wrote in message ... This line works for me: rngSource.Copy Destination:=wsTarget.Range("A2") but I'd like to add: PasteSpecial Paste:=xlFormats, PasteSpecial Paste:=xlValues I'm not getting the syntax right. Could someone help me out please? Also, since the number of rows in my target changes, I would have preferred to use something like: rngSource.Copy Destination:=wsTarget.Range("A" & lstRow + 1) but it fails, even though I know I have defined lstRow. Thanks in advance! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
Copy; Paste; Paste Special are disabled | Excel Discussion (Misc queries) | |||
Copy & paste special | Excel Worksheet Functions | |||
Copy - Paste Special | Excel Discussion (Misc queries) | |||
Dynamic Copy/Paste Special Formulas/Paste Special Values | Excel Programming |