View Single Post
 
Old 11-14-2017, 01:05 PM
PMC11 PMC11 is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Nov 2017
Posts: 2
PMC11 is on a distinguished road
Default Change Text Colour in Cell Based on Text in Same Cell

Hi,

I am new to VBA so I am struggling with what seems to be quite a simple task.

I have a few lines of text in each cell in a word document. Each cell contains a category such "Science" or "Health" or one of several others. At the minute I'm actually just using a special character such as "*" or "@" for testing purposes.

I need the text colour of all text in the cell to change depending on which category is in the cell. So the text would be e.g. green for "Science" and red for "Health".

It seems that running a macro is quickest way of making these changes (there will be over 200 such cells in my final document and colouring manually is such a waste of time). Basically, I'm struggling with first changing the colour of all the text in the cell, and secondly how to make the macro search again if the first criteria is not met. I would like 1 macro that could complete colouring for the entire document, rather than having multiple macros for each colour I need.

If you could give me some examples of VBA I could work with that would be most helpful. I'm really struggling and any help you could give will save me and my team so much time.
Reply With Quote