Ace16150s
Ace16150s

Reputation: 97

MS Excel VBA - Copying SpecialCells while keeping the destination formatting

I would like to copy these special cells to a destination, while keeping the destination's formatting. I'm thinking I have to put .values somewhere in the lines. The code is as follows:

GRBReportSheet.Range("C" & GRBReportSheetFR & ":E" & GRBReportSheetLR).SpecialCells(xlCellTypeVisible).Copy Destination:=GRB.Range("C30")
GRBReportSheet.Range("F" & GRBReportSheetFR & ":J" & GRBReportSheetLR).SpecialCells(xlCellTypeVisible).Copy Destination:=GRB.Range("H30")

Thank you in advance for your time!

Upvotes: 1

Views: 482

Answers (1)

SJR
SJR

Reputation: 23081

Try this.

GRBReportSheet.Range("C" & GRBReportSheetFR & ":E" & GRBReportSheetLR).SpecialCells(xlCellTypeVisible).Copy
GRB.Range("C30").PasteSpecial xlValues

GRBReportSheet.Range("F" & GRBReportSheetFR & ":J" & GRBReportSheetLR).SpecialCells(xlCellTypeVisible).Copy
GRB.Range("H30").PasteSpecial xlValues

Upvotes: 2

Related Questions