How to Highlight Text in Text Box in Excel (3 Handy Ways)

Get FREE Advanced Excel Exercises with Solutions!

If you are looking for ways to highlight text in the Excel text box, then you are in the right place. So, let’s get started with the main article to know 3 effective ways of doing this task.


How to Highlight Text in Text Box in Excel: 3 Ways

Here, we have the following dataset containing a list of salaries for different employees. To mention their company name we have added a text box filled with the company name. Throughout this article, we will try to highlight the full text or a specific text portion of this text box.

how to highlight text in excel text box

We have used the Microsoft Excel 365 version for creating this article. However, you can use any other version at your convenience.


Method-1: Using Font Group to Highlight Text in Text Box in Excel

Here, we will be using some features of the Font group to highlight the texts of this indicated text box.

using font group to highlight text in excel text box

Steps:

Firstly, we will use the Fill Color feature which will change the color of the whole text box, so using this feature you will not be able to highlight only a portion of text.

  • Select the text box and go to the Home tab >> Font group >> Fill Color dropdown >> Green, Accent 6, Lighter 60%.

fill color

After that, you will be able to highlight the whole text of the text box.

Nonetheless, using the Font Color feature we can change the font color of a specific text to highlight it.

  • Select your desired portion of text in the text box (here we have chosen ABC) and go to the Home tab >> Font group >> Font Color dropdown >> Red.

using font color to highlight text in excel text box

Eventually, the name of the company will be highlighted in red color font.

Read More: How to Highlight Text in Excel


Method-2: Utilizing Format Shape Option

In this section, we will be utilizing the Format Shape option to highlight the specific text ABC in the text box.

using format shape option to highlight text in excel text box

Steps:

  • Select your desired portion of text in the text box (here we have chosen ABC) and right-click on your mouse to select the Format Shape

In this way, you will have the Format Shape dialog box on the right portion of your worksheet.

  • Go to the Text options tab >> Text Effects >> Glow >> Theme Colors >> Light Blue.

theme color

After selecting the color, choose 15 pt as the Size, and 0% as the Transparency.

Eventually, your selected portion of text in the text box will be highlighted like the following figure.

result after highlighting text in excel text box

Read More: How to Highlight a Column in Excel


Method-3: Applying VBA Code to Highlight Text in Text Box after Auto Selection in Excel

Here, we will be using a UserForm text box, and then using a VBA code we will try to highlight the whole portion of the text of this box through selection.

VBA code to highlight text in excel text box


Step-01: Inserting User Form Text Box

Here, we will insert a User Form control text box to write the company name.

  • Go to the Developer tab >> Insert dropdown >> Text Box (ActiveX Control).

user form text box

After that, a plus symbol will appear by dragging which we can create our text box.

  • Drag the plus(+) sign down and to the right side.

dragging plus symbol

In this way, we have created the following text box.

To be able to write on this text box we have to enable the Design Mode.

  • Go to the Developer tab >> Design Mode option >> Select the text box.
  • Type the name of the company, ABC Company.

You can adjust the size of the text box by dragging it to the right or left side.

  • Drag the left point to the right side and the right point to the left

adjusting size to highlight text in excel text box

After that, we got our desired shape.


Step-02: Applying VBA Code

Now, we will apply a simple VBA code to highlight the whole text of the box after selecting this box.

  • Right-click on the text box.
  • Choose the View Code

applying VBA code to highlight text in excel text box

After that, you will be taken to the code window where the following Change event will be created automatically.

  • Change the event from Change to MouseDown.

After that, the MouseDown event will be created with the following indicated code.

mousedown event

  • Remove the unnecessary Change event code.

  • Keep your mouse cursor in the following indicated portion of the MouseDown event code.

  • Type the following two lines of code in that portion.
Me.TextBox1.SelStart = 0
Me.TextBox1.SelLength = Len(Me.TextBox1)

Here, Me is for calling the User Form and then TextBox1 indicates our created text box.
SelStart indicates the starting position of the text which is 0 which means we are starting from the extreme left position of the text.
SelLength will determine the total length of the characters as we want to highlight the whole text so we are using the VBA LEN function to determine the length of the texts in the text box.

inserting code to highlight text in excel text box

  • After saving the code press ALT+Q to close the code window.

So, we have returned to the worksheet again.

  • After selecting the text box go to the Developer tab >> disable the Design Mode

disable design mode

Now, if you select any place in the text box all of the texts in this text box will get highlighted.

resultant view after highlighting text in excel text box


Practice Workbook

For doing practice, we have added a Practice portion on each sheet on the right portion.

practice section to highlight text in text box


Download Workbook


Conclusion

In this article, we tried to show the ways to highlight text in a text box in Excel. Hope you will find it useful. If you have any suggestions or questions, feel free to share them in the comment section.


Related Articles

What is ExcelDemy?

ExcelDemy Learn Excel & Excel Solutions Center provides free Excel tutorials, free support , online Excel training and Excel consultancy services for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Tanjima Hossain
Tanjima Hossain

Hello everyone, This is Tanjima Hossain. I have completed my graduation from BUET. Then I have started working as a technical writer in SOFTEKO. I have grown interest in technical content writing, research topics, numerical analysis related field and so I am here. Besides this I love to interact with different people and I love to spend my spare time by reading, gardening ,cooking etc.

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo