简体   繁体   中英

Copy values instead of formulas

Could someone help me tweak this slightly so it copies and pastes just the values to the cells and not the formulas?

Set copyRange = wsInfoFrom.Range("A1:A" & lastrow) 
copyRange.SpecialCells(xlCellTypeVisible).Copy wsInfoTo.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Worksheets("View").Activate

Regards, Mils

Something like this should work

Sheets("Sheet1").Columns(1).Copy
Sheets("Sheet2").Columns(2).PasteSpecial xlPasteValues

Don't have excel available to me at the moment but I believe you'd use PasteSpecial like this in your example:

wsInfoTo.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues

Fist you select the source range Then you select the target range Set copy to sc and pastespecial to target range and there you go :D

Set copyRange = ActiveSheet.Range("A1:A" & lastrow)
copyRange.SpecialCells(xlCellTypeVisible).Copy
ActiveSheet.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Worksheets("View").Activate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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