Sub s()
Dim c As Range, d As Object, i As Integer, n As Integer
Set d = CreateObject("scripting.dictionary")
With Sheets(1)
n = .Cells(.Rows.Count, 1).End(3).Row
For i = 1 To n
d(.Cells(i, 1).Text) = .Cells(i, 2)
Next
End With
For Each c In Sheets(2).UsedRange
If d.exists(c.Text) Then
c = d(c.Text)
End If
Next
End Sub
在SHEET2的B1中输入或复制粘贴下列公式
=VLOOKUP(A1,SHEET1!A:B,2,0)
或
=IF(COUNTIF(SHEET1!A:A,A1),VLOOKUP(A1,SHEET1!A:B,2,0),"查无此国家")
下拉填充
用VBA程序:
Sub test()
For i = 2 To Cells(Rows.Count, 1).End(3).Row
Sheets(2).Cells.Replace What:=Cells(i, 1), Replacement:=Cells(i, 2), LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Next
End Sub