Then press F5 key to run this code, and a prompt box will pop out to remind you enter the text that you want to highlight only, see screenshot:Ĥ. Characters(Start:=Len(xTmp) + 1, Length:=y).Font.ColorIndex = 3ģ. VBA code: Highlight a part of text within a cell: Sub HighlightStrings()ĬFnd = InputBox('Enter the text string to highlight')
Click Insert > Module, and paste the following code in the Module Window. Select the cells which you want to highlight the specific text, and then hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.Ģ. To highlight only part of text within a cell, the following VBA code can help you.ġ. Highlight specific text within a cell based on other text with VBA codeįor example, I have a range of text strings, and now, I want to highlight the specific text “ Sky” in these cells to get the result as following screenshots shown:
Highlight one or more specific text within multiple cells with an amazing feature Highlight one or more specific text within multiple cells with VBA code