extremealv
New Member
- Joined
- Nov 27, 2023
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
I am new to VBA and I tried searching for a solution in the forum and nothing similar was found.
I am trying to Find and Replace.
Here is what I have. In one specific sheet I would like to look for either NA, EMEA, ASIA. Then I would like to replace it only with JAPAN. I managed to do it using only the first value but I do not understand how to write a VBA where it will check the first value "NA" and check the next one "EMEA" and so on.
Sub ChangeValue()
Dim sht As Worksheet
Dim fndList As Variant
Dim rplcList As Variant
Dim x As Long
fndList = Array("NA", "EMEA", "ASIA")
rplcList = Array("Japan!")
Set sht = Sheets("Sheet 1")
sht.Cells.Replace What:=fndList, Replacement:=rplcList, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False
I am trying to Find and Replace.
Here is what I have. In one specific sheet I would like to look for either NA, EMEA, ASIA. Then I would like to replace it only with JAPAN. I managed to do it using only the first value but I do not understand how to write a VBA where it will check the first value "NA" and check the next one "EMEA" and so on.
Sub ChangeValue()
Dim sht As Worksheet
Dim fndList As Variant
Dim rplcList As Variant
Dim x As Long
fndList = Array("NA", "EMEA", "ASIA")
rplcList = Array("Japan!")
Set sht = Sheets("Sheet 1")
sht.Cells.Replace What:=fndList, Replacement:=rplcList, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False