Highlight all appearances of a particular variable used

Tejas Kore

Board Regular
Joined
Nov 2, 2017
Messages
72
Office Version
  1. 365
Platform
  1. Windows
Hi Friends,

I have used one variable in my code , let's say x_arr.
Now I have used this variable n number of times in my vba code.But now for some reason I need to change the name of this variable. Since I have used this variable n number of times , I have to make n number of changes.
Is there any way to highlight all the appearances of the variable so that my job gets easier.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Yes of course, VBA Editor has the find/replace option of most MS applications. As this will be your fist time using it, I would copy ALL of your offending code into notepad. Use replace ALL in notepad and check that it has successfully worked. You will then be able to paste the new code back into the module.
 
Upvote 0
Solution
Hi TonyUK72,

Thanks a lot for your proactive approach.
I just wanted to clarify further.
Do we have such option in VB Editor itself ? Or we have to copy code to notepad , make necessary changes , and then again copy back to module ?
 
Upvote 0
Thanks a lot TonyUK72 for guiding me.
It was really helpful.I searched in VB Editor and managed to do that.

Once again .. Thanks a lot
 
Upvote 0
"Ctrl + H" within the VBA Editor, I recommended notepad as if the expression you want to replace is referenced (or is even part off) it will also be replaced!!!!
 
Upvote 0
Oh My God !!! .. I didn't realised that in your first reply.
I will keep that in mind while doing such operations.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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