PDA

View Full Version : Macro to Search and Replace word within another Macro



Viko
01-24-2010, 01:38 PM
Is there a way to Search and Replace All occurrences of a word within the whole VBA project via MACRO?

Appreciate any help!

lucas
01-24-2010, 01:41 PM
Why would you duplicate a function that exists?

Viko
01-24-2010, 02:17 PM
I do not want to duplicate just change one word within the Project rapidly.
For exaple if I am referencing the sheet name many times within the code and then want to change the sheet name to switch the code rapidly to the new sheet name. That is just an exampe but that is my idea

lucas
01-24-2010, 02:31 PM
That funtionality is available in the VBE.

Under edit-Replace you can replace words on the procedure, module or project level by selecting the correct radio button.

Viko
01-24-2010, 02:41 PM
Yes I now that, but I was wondering if I can do that by another macro?

lucas
01-24-2010, 02:48 PM
Can't think why but type this in a module and add the period to see the functions available through intellisense:

With Application.VBE
put the period after VBE and hit enter.

Viko
01-24-2010, 02:55 PM
Sory, but I do not understand how this will do the work?

Can you please provide the code as it should look in its completeness

Many thanks!

lucas
01-24-2010, 03:05 PM
It doesn't do the search but it will let you decide which parts of the VBE you want to work with.

lucas
01-24-2010, 03:34 PM
I really can't help you much more with this. I think it's a lot of work for something that exists......I think it will be quite a bit of involved coding.

Maybe someone with more knowledge on the issue will drop by.