我有以下代码:
Dim wsData as Worksheet
Dim ctryToTex As Range
Set wsData = ActiveSheet
Set ctryToTex = wsData.Columns("A")
With ctryToTex
.Replace What:="01", Replacement:="UK", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="03", Replacement:="Norway", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="04", Replacement:="Sweden", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="05", Replacement:="Finland", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="06", Replacement:="Denmark", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="09", Replacement:="Germany", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="11", Replacement:="Switzerland", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="12", Replacement:="Netherlands", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="13", Replacement:="Belgium", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="16", Replacement:="Italy", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="17", Replacement:="Spain", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
.Replace What:="21", Replacement:="France", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
End With
我希望它用“A”列中的国家/地区替换数字,而是宏替换工作表中所有找到的值。