我有下面的代码,其中数据显示在工作表中的工作表中的工作表COT和查找值中。但是代码没有给我预期的回报,请你帮忙吗?
Dim aCell As Range
Dim S1 As Worksheet
Dim S2 As Worksheet
Dim W1 As Workbook
Set W1 = ThisWorkbook
Set S1 = W1.Sheets("COT")
Set S2 = W1.Sheets("Sheet1")
With S2
For Each aCell In .Range("A2:A" & LastRow)
.Cells(aCell.Row, 2) = Application.WorksheetFunction.VLookup(aCell.Value, S1.Range("A:D"), 2, 0)
Next
End With