Copy & PSV, then add formats

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Copy & PSV, then add formats

Post by VegasNath »

Code: Select all

wb1.Sheets("Detail").Range("B" & j & ":BS" & j).Copy Destination:=(wb2.Sheets("Detail").Range("B" & i))
How can I adjust this to paste as special values, but then copy the formats from wb2.Sheets("Detail").Range("B" & i - 1) (down a row)
:wales: Nathan :uk:
There's no place like home.....

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Copy & PSV, then add formats

Post by HansV »

' Copy range on wb1
wb1.Sheets("Detail").Range("B" & j & ":BS" & j).Copy
' Paste special values only to range on wb2
wb2.Sheets("Detail").Range("B" & i & ":BS" & i).PasteSpecial Paste:=xlPasteValues
' Copy row above
wb2.Sheets("Detail").Range("B" & (i - 1) & ":BS" & (i - 1)).Copy
' Paste special formats only
wb2.Sheets("Detail").Range("B" & i & ":BS" & i).PasteSpecial Paste:=xlPasteFormats
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Copy & PSV, then add formats

Post by VegasNath »

Thanks Hans
:wales: Nathan :uk:
There's no place like home.....