Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy_Paste Special

Status
Not open for further replies.

jrobin5881

Technical User
Mar 10, 2004
228
US
I'm trying to copy a range from one sheet and PasteSpecial to another located in the same workbook but I can't seem to get the PasteSpecial to work. I'm getting error messages. Here's my code: it's quite simple.(My actual code does not wrap as it does here in my post)
Code:
Sub CopyRng()

Set rng1 = Workbooks("ConditionReporting(version4).xls").Sheets("excExcelDownload").Range("BK16:BM22")
Set rng2 = Workbooks("ConditionReporting(version4).xls").Sheets("Summary").Range("C7")
Set rng3 = Workbooks("ConditionReporting(version4).xls").Sheets("excExcelDownload").Range("BN16:BQ22")
Set rng4 = Workbooks("ConditionReporting(version4).xls").Sheets("Summary").Range("H7")
Set rng5 = Workbooks("ConditionReporting(version4).xls").Sheets("excExcelDownload").Range("BR16:BS22")
Set rng6 = Workbooks("ConditionReporting(version4).xls").Sheets("Summary").Range("M7")

rng1.Copy rng2
rng3.Copy rng4
rng5.Copy rng6

End Sub
 
I'm getting error messages
Which messages ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I'm sorry... I added .PasteSpecial after my destination range and I'm getting an error message that states,"Method 'PasteSpecial' of object 'Range' failed"

Code:
rng1.copy rng2.PasteSpecial
 
You wanted this ?
rng1.Copy
rng2.PasteSpecial

with no parameter to the PasteSpecial method ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 


Code:
rng1.copy 
rng2.PasteSpecial xlPasteAll    'or some valid type

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Yep, well I want to copy range 1 to range 2 and paste special values only. If I seperate the two lines it'll work?
 
rng1.Copy
rng2.PasteSpecial xlPasteValues

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 



Code:
rng1.copy 
rng2.PasteSpecial xlPasteValues    'or some valid type


Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks guys! Worked fine. What a difference a seperation makes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top