0
如果條件爲真,我有此代碼將表格中的行復制到另一個工作簿,但是我遇到了一些問題。 Sheet1的單元格具有公式,我只想將這些值粘貼到Sheet2。 如何在此代碼中執行此操作?通過VBA將行從一行復制到另一個工作簿
Sub CopyRows()
Dim cell As Range
Dim lastRow As Long, i As Long
Dim FName As String
Dim FPath As String
Dim NewBook As Workbook
lastRow = Range("A" & Rows.Count).End(xlUp).Row
i = 1
For Each cell In Sheets("Sheet1").Range("T1:T" & lastRow)
If cell.Value = "X" Or cell.Value = "Y" Then
cell.EntireRow.Copy Sheets("Sheet2").Cells(i + 1, 1)
i = i + 1
End If
Next
End Sub