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.
Download Workbook
3 Ways to Highlight Text in Text Box in Excel
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.
We have used 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.
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%.
After that, you will be able to highlight the whole texts of 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.
Eventually, the name of the company will be highlighted in the red color font.
Read More: VBA to Change Cell Color Based on Value in Excel (3 Easy Examples)
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.
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.
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.
Read More: How to Change Cell Color Based on a Value in Excel (5 Ways)
Similar Readings
- How to Highlight a Row in Excel (2 Effective Ways)
- Excel VBA to Highlight Cell Based on Value (5 Examples)
- How to Highlight a Cell in Excel (5 Methods)
- Excel Cell Color: Add, Edit, Use & Remove
- How to Highlight a Column in Excel (3 Methods)
Method-3: Applying VBA Code to Highlight Text in Text Box after Auto Selection in Excel
Here, we will be using a user form text box, and then using a VBA code we will try to highlight the whole portion of the text of this box through selection.
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).
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.
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
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
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.
- 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 is indicating our created text box.
SelStart indicates the starting position of 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.
- 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
Now, if you select any place in the text box all of the texts in this text box will get highlighted.
Read More: Highlight Cells That Contain Text from a List in Excel (7 Easy Ways)
Practice Workbook
For doing practice, we have added a Practice portion on each sheet on the right portion.
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. You can visit our site Exceldemy for more Excel-related articles.