vba----调用新的excel 回填本excel的数据
Sub find()
endRow = Sheet24.Range("a65536").End(xlUp).Row
For rowindex = 1 To endRow
keyvalue = Sheet24.Cells(rowindex, 1)
FindFile = "C:\TEMP\sn.xlsx"
Workbooks.Open filename:=FindFile
Dim ShFind As Worksheet
Set ShFind = Workbooks("sn.xlsx").Sheets(1)
Set findcell = ShFind.Columns("B").find(keyvalue, LookAt:=xlWhole) ' xlWhole 完全匹配,xlPart 模糊匹配
If Not findcell Is Nothing Then
'MsgBox findcell.Row
Sheet24.Cells(rowindex, 10) = ShFind.Cells(findcell.Row, 4)
Else
MsgBox "没找到符合条件的单元格"
End If
Workbooks("sn.xlsx").Close SaveChanges:=False
Next
End Sub

浙公网安备 33010602011771号