PDA

View Full Version : Solved: Copy only values



austenr
11-30-2006, 12:44 PM
What do you need to include in this code to paste only the values and not the formats?

Range("B170:n170").Copy Destination:=Range("E9")

lucas
11-30-2006, 01:18 PM
Sub Macro1()
Dim Rng1 As Range, Rng2 As Range
Set Rng1 = ActiveSheet.Range("B170:n170")
Set Rng2 = ActiveSheet.Range("E9")
Rng1.Copy
Rng2.PasteSpecial Paste:=xlValues
End Sub

austenr
11-30-2006, 01:27 PM
thanks Lucas. That works for me.

mdmackillop
11-30-2006, 03:16 PM
Hi Austen
Just for info, you can't PasteSpecial in the same line of code as Copy, as per your original post. You need to code as Steve has shown.
regards
MD