如何进一步修改代码,以便只将值粘贴到我的“Cable_List”工作表而不是“数据”表中的公式。
Dim strLastRow As String
Dim rngC As Range
Dim strToFind As String, FirstAddress As String
Dim wSht As Worksheet
Dim rngtest As String
Application.ScreenUpdating = False
Set wSht = Worksheets("Data")
With wSht.Range("BM:BM")
Set rngC = .Find(What:="PVC", LookAt:=xlPart)
If Not rngC Is Nothing Then
FirstAddress = rngC.Address
Do
strLastRow = Sheets("Cable List").Range("A" & Rows.Count).End(xlUp).Row + 1
rngC.EntireRow.Copy Sheets("Cable List").Cells(strLastRow, 1) 'part where copy and paste was done
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address <> FirstAddress
End If
End With
致谢:sarasotavince
答案 0 :(得分:0)
更改此行:
rngC.EntireRow.Copy Sheets("Cable List").Cells(strLastRow, 1)
到此:
rngC.EntireRow.Copy
Sheets("Cable List").Cells(strLastRow, 1).PasteSpecial xlPasteValues
Application.CutCopyMode = False