Textbox
Draw a Textbox | Populate a Textbox | Clear a Textbox
A textbox is an empty field where the user can fill in a piece of text. Learn how to draw a textbox on your worksheet, how to refer to a textbox in your Excel VBA code, and how to clear a textbox.
Draw a Textbox
Excel 2010 and Excel 2007 users. Click on Insert from the Developer tab and then click on Text Box in the ActiveX Controls section.

Excel 2003 users. Click on Text Box from the Control ToolBox.

1. Draw a textbox and a command button on your worksheet.

2. You can change the caption of the command button by right clicking on the command button and then clicking on Properties and Caption (make sure Design Mode is selected).
3. You can change the name of the textbox by right clicking on the textbox and then clicking on Properties and Name. For now, we will leave TextBox1 as the name of the textbox.
Populate a Textbox
To populate the textbox, execute the following steps:
1. Right click on the command button. Click on View Code. Add the following code line:
Result when you click the command button on the sheet:

2. To place text from a textbox into a cell, add a code line like this:
Clear a Textbox
To clear a textbox, use the following code line:
Although in some situations it can be useful to directly place a textbox on your worksheet, a textbox is particularly useful when placed on a Userform.
Did you find this information helpful? Show your appreciation, vote for us.