粘贴单元格值而不是公式

我正在search多个工作表的string,一旦find这个string它将其复制到合并数据表。

我遇到的问题是应付公式,而不是价值。 我一直在寻找小时,似乎无法find解决办法。

这是我目前正在使用的代码。

任何援助,您可以提供非常感谢!

谢谢阿隆

Private Sub CommandButton1_Click() Dim FirstAddress As String, WhatFor As String Dim Cell As Range, Sheet As Worksheet With Application .ScreenUpdating = False .EnableEvents = False .CutCopyMode = False End With WhatFor = Sheets("SUB CON PAYMENT FORM").Range("L9") Worksheets("MergedData").Cells.Clear If WhatFor = Empty Then Exit Sub For Each Sheet In Sheets If Sheet.Name <> "SUB CON PAYMENT FORM" And Sheet.Name <> "MergedData" _ And Sheet.Name <> "Details" Then With Sheet.Columns(1) Set Cell = .Find(WhatFor, LookIn:=xlValues, LookAt:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) If Not Cell Is Nothing Then FirstAddress = Cell.Address Do Cell.EntireRow.Copy ActiveWorkbook.Sheets("MergedData").Range("A" & Rows.Count)_ .End(xlUp).Offset(1, 0) Set Cell = .FindNext(Cell) Loop Until Cell Is Nothing Or Cell.Address = FirstAddress End If End With End If Next Sheet Set Cell = Nothing End Sub 

在别人的帮助下,我所要做的就是取代。

 Cell.EntireRow.Copy ActiveWorkbook.Sheets("MergedData").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) 

有了这个:

 Cell.EntireRow.Copy ActiveWorkbook.Sheets("MergedData").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlValues 

不要对目标使用range.copy方法,而只使用复制并使用PasteSpecialXlPasteType = xlPasteValues

Range.PasteSpecial方法(Excel)