omarahmedfazal
New Member
- Joined
- Aug 22, 2023
- Messages
- 1
- Office Version
- 2021
- Platform
- Windows
Hello All,
I have trouble running the following macro (See the attached image).
Basically, the intention of this code is to find "Pound Sterling", "Outgoing amount ATM/Dispenser", "Banknote" within a particular sheet and replace it with "Libra Esterlina", "Salida dotación ATM", "Billete".
Upon running the code, the following is highlighted and fails to run;
I have to mention that "Pound Sterling", "Outgoing amount ATM/Dispenser", "Banknote" will always be in columns C:H (Not attached). But, I do not know if it is in this code.
Could you please let me know what I am doing wrong, why I am getting the error, and what I can do to rectify it?
I have trouble running the following macro (See the attached image).
VBA Code:
Sub Translation()
Dim fndList As Variant
Dim rplcList As Variant
Dim x As Long
fndList = Array("Pound Sterling", "Outgoing amount ATM/Dispenser", "Banknote")
rplcList = Array("Libra Esterlina", "Salida dotación ATM", "Billete")
'Loop through each item in Array lists
For x = LBound(fndList) To UBound(fndList)
Target.Replace What:=fndList(x), Replacement:=rplcList(x), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False
Next x
End Sub
Basically, the intention of this code is to find "Pound Sterling", "Outgoing amount ATM/Dispenser", "Banknote" within a particular sheet and replace it with "Libra Esterlina", "Salida dotación ATM", "Billete".
Upon running the code, the following is highlighted and fails to run;
VBA Code:
Target.Replace What:=fndList(x), Replacement:=rplcList(x), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=FalseThe error message is "run-time error 424 object required".
I have to mention that "Pound Sterling", "Outgoing amount ATM/Dispenser", "Banknote" will always be in columns C:H (Not attached). But, I do not know if it is in this code.
Could you please let me know what I am doing wrong, why I am getting the error, and what I can do to rectify it?