Hi
Does anyone know of a way to search and replace code in VBA for more than one line as I need to change a lot of blocks of code and to do it manually will increase the possibility of errors.
Many thanks
Jeff
Hi
Does anyone know of a way to search and replace code in VBA for more than one line as I need to change a lot of blocks of code and to do it manually will increase the possibility of errors.
Many thanks
Jeff
Hi, Possibly "Edit On the VB ToolBar Then "Find" or "Find Next" Or "Replace".
Mick
Hi
Thanks but the find and replace function only allows for one line of text, e.g. if you select multiple lines only the first line is included.
The problem is I have a large number of blocks of twenty to thirty lines each and to avoid any errors in the process, would like to find and replace the block of text.
Regards
Jeff
I don't know of a way, but one could be cheeky if one was so inclined and say that if you have the same large code segment repeated so many times in your code you should have placed it in a seperate sub / function and then used a 'call' to it...
You could then of course just 'repaired' the one copy of it...
Lesson learned maybe?
If you find the response helpful please click the scales in the blue bar above and rate it
If you don't like the response, don't bother with the scales, they are not for you
Hi
I will agree with you on that one and it applies to some but not all of what I want to do and I will look at changing that where it applies.
However some of the code I wish to change is repeated in other areas, but it is only the code that falls between specific lines of code that I wish to replace so I cannot use a single line replace.
I was wondering if anyone else has found a solution.
Thanks
Jeff
Hello Jeff,
It is possible using RegExp (VBScript Regular Expressions). If you post either your workbook or a sample, I will write the code for you.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Star below the post.3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Hi
Thanks Leith, I have checked it out and think I should be able to manage it now, thanks for the info and the offer.
Regards
Jeff
Hello Jeff,
If you have any problems with using RegExp, let me know.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks