我似乎无法循环遍历第一个表上的所有行以使用vba从第二个表中获取一些数据。
Dim ws1 As Worksheet, ws2 As Worksheet
Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")
On Error Resume Next
searches = Application.WorksheetFunction.vlookup(ws1.Range("$A"), ws2.Range("$A:$B"), 1, False)
On Error GoTo 0
If (IsEmpty(searches)) Then
ws1.Range("$C").Formula = CVErr(xlErrNA)
Else
ws1.Range("$C").Value = searches
End If
这不能让我传递Sheet1中整个范围为C的列。