Public Sub replace()
For i = 1 To 10
For j = 1 To 8
If Sheet1.Cells(i, 1) <> "" And Sheet2.Cells(j, 2) <> "" And Sheet1.Cells(i, 1).Value = Sheet2.Cells(j, 2).Value Then
'MsgBox (Cells(J, 2).Value)
Sheet1.Cells(j, 3) = Sheet2.Cells(j, 2)
End If
Next j
Next i
End Sub
持续改进:从不同表取值