Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlighting individual words in a cell with VBA
I wonder if this could be done...
I have a file with a column whose cells are descriptions, each cell with maybe 20 to 30 words. What I want to do is look for some words in the column and highlight them. For example, there is this sentence in one of the cells: An apple a day keeps the doctor away. I want to highlight NOT the whole sentence BUT ONLY the word "doctor" in red. I have tried to do this by editing a recorded macro. The result wasn't very successful. What I managed to do was to highlight the words "An apple a day keeps the doctor" in red, in other words, from the beginning of the sentence to the word itself. The task is complicated by the fact that I might want to highlight multiple words in the same sentence. For example, I might want to highlight both "apple" and "doctor" in red. Can the above been done? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlighting individual words in a cell with VBA
Shatin,
Use the Characters property of the cell to access the individual characters of text. For example, Range("A1").Characters(26, 6).Font.ColorIndex = 3 -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Shatin" wrote in message om... I wonder if this could be done... I have a file with a column whose cells are descriptions, each cell with maybe 20 to 30 words. What I want to do is look for some words in the column and highlight them. For example, there is this sentence in one of the cells: An apple a day keeps the doctor away. I want to highlight NOT the whole sentence BUT ONLY the word "doctor" in red. I have tried to do this by editing a recorded macro. The result wasn't very successful. What I managed to do was to highlight the words "An apple a day keeps the doctor" in red, in other words, from the beginning of the sentence to the word itself. The task is complicated by the fact that I might want to highlight multiple words in the same sentence. For example, I might want to highlight both "apple" and "doctor" in red. Can the above been done? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Format individual coloumn cell with corresponding coloum cell resu | Excel Worksheet Functions | |||
Creating a separate cell entry for every individual line in a cell | Excel Discussion (Misc queries) | |||
Calculate and display individual error bars for individual points | Charts and Charting in Excel | |||
Calculate and display individual error bars for individual points | Charts and Charting in Excel | |||
Highlighting blanks via GO TO SPECIAL is not highlighting blank cells - HELP, I'm totally stuck. | Excel Discussion (Misc queries) |