View Single Post
 
Old 05-30-2017, 04:42 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Changing the font colour is not a problem but you are going to get confusing results if there is already red text in the document before you run the code. Your sample doc has a bunch of red text in the last table. So you probably need to add code up the top that sets everything to black before you begin (like the code that unhides everything at the start).

The extra condition of highlighting rows when the text appears in the second column is unclear. Are you trying to highlight the row in the last table or in the feeder tables or both?

Do you want the red if the sText appears in the second column but not if it appears in the third column? If so then you need a way of storing that extra piece of info as you build the list of hits. You might write to two separate strings for each column if you didn't want to change the code dramatically. Or you might add a substring with each ref and then do a split on a split.

You might use a Dictionary object to store the hits and locations so you can apply the formatting in a single pass. A Dictionary would be the preferred option now you've added these extra conditions but the coding changes would be more extensive and might be superceded yet again as you ask for more things.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote