简体   繁体   English

MS Excel VBA-在保留目标格式的同时复制SpecialCells

[英]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. 我想我必须将.value放在行中的某个位置。 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! 预先感谢您的宝贵时间!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM