查找值并将整行复制到另一个 sheet
Find value and copy entire row to another sheet
我正在尝试创建 vba 代码,但没有成功。
我想在第 "F" 列上搜索值:"Answered"
然后从 "COLUM B TO F" 复制行并粘贴到 sheet "ControlAnswered" lastrow;
试试这个,
Sub SpecialCopy()
Dim targetSh As Worksheet
Set targetSh = ThisWorkbook.Worksheets("ControlAnswered")
Dim i As Long
For i = 1 To Cells(Rows.Count, "F").End(xlUp).Row
If Cells(i, 6).Value = "Answered" Then
Range(Cells(i, 2), Cells(i, 6)).Copy Destination:=targetSh.Range("A" & targetSh.Cells(Rows.Count, "A").End(xlUp).Row + 1)
End If
Next i
End Sub
我应该说你不会总能找到会为你编写代码的人
我正在尝试创建 vba 代码,但没有成功。
我想在第 "F" 列上搜索值:"Answered" 然后从 "COLUM B TO F" 复制行并粘贴到 sheet "ControlAnswered" lastrow;
试试这个,
Sub SpecialCopy()
Dim targetSh As Worksheet
Set targetSh = ThisWorkbook.Worksheets("ControlAnswered")
Dim i As Long
For i = 1 To Cells(Rows.Count, "F").End(xlUp).Row
If Cells(i, 6).Value = "Answered" Then
Range(Cells(i, 2), Cells(i, 6)).Copy Destination:=targetSh.Range("A" & targetSh.Cells(Rows.Count, "A").End(xlUp).Row + 1)
End If
Next i
End Sub
我应该说你不会总能找到会为你编写代码的人