【发布时间】:2018-04-11 09:35:24
【问题描述】:
我的代码执行我想要的操作,但它会将其复制到工作表 2 中的 A 列。如果可能,我希望它将数据从 B 列开始。
Sub EFP()
Dim keyword As String: keyword = Sheets("Results").Range("B3").Value
Dim countRows1 As Long, countRows2 As Long
countRows1 = 3 'the first row of my dataset in the Data tab
endRows1 = 500 'the last row of my dataset in the Data tab
countRows2 = 6 'the first row where I want to start writing the found rows
For j = countRows1 To endRows1
If Sheets("Data").Range("B" & j).Value = keyword Then
Sheets("Results").Rows(countRows2).Value = Sheets("Data").Rows(j).Value
countRows2 = countRows2 + 1
End If
Next j
结束子
【问题讨论】:
标签: vba excel excel-formula