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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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