Issue with Macro: Run-time Error

omarahmedfazal

New Member
Joined
Aug 22, 2023
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
Hello All,

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?
 

Attachments

  • Screenshot 2023-08-21 151133.png
    Screenshot 2023-08-21 151133.png
    19.1 KB · Views: 8

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Issue with Macro: Run-time error
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top