Tutorial Details
Downloadable Files: Excel File
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Add Text to UserForms and Labels

Add to Favorites
Author: | Edits: don

Multiple methods for adding text to a UserForm via a Label.

This includes a simple way to add basic text and a way to add a lot of text, including new lines.


Add Text to a UserForm

Add Text using VBA

Multiple Lines of Text in a Label

Add Text from the Worksheet


Add Text to a UserForm

A Label is the control that you use to add text to a UserForm. 

Click the UserForm and look to the Toolbox (go to View > Toolbox if you don't see it).

Click the A in the toolbox.


Once you click the A, go to the form and click and drag until a label appears.


To learn more about this procedure, view our tutorial on adding controls to UserForms.

Add the Text

Once you have the label, look to the Properties window and change the Caption property. This controls what text appears in the label. If you don't see the properties window, make sure you clicked the Label and hit F4.


This is the simplest way to add text to a UserForm.

You may have noticed in other examples that the text looks different than this default text; to change the appearance, adjust the Font property.

Add Text using VBA

We can also add text to a Label using VBA, and this makes it a bit easier to add more text.

The above method works great for small amounts of text, but it can be really annoying to manage a larger section of text or when you want to add multiple separate lines to a Label; this section solves that problem.

Where to Add the Text

The text is added in the UserForm_Initialize event. In the VBA Project window, right-click the desired UserForm and click View Code.


In the window that opens look for a section titled UserForm_Initialize(). If you don't see this section, look to the drop-down menus at the top of the window and select UserForm from the left one and Initialize from the right one. This section of code is what is run when the form opens.


How to Add the Text

Label1.Caption = "Hi there!"

Label1 is the name of the label. You can see this when you click the label and look to the (Name) section of the Properties window.

Caption tells the form to add text to the label.

Everything in the quotation marks is what you want to add to the label.


The next section shows you how to add multiple lines of text.

Multiple Lines of Text in a Label

VBA allows us to add multiple lines, which adds a bit more formatting to the Label.

Label1.Caption = "Hi there!" & vbNewLine & "More stuff."

vbNewLine adds the new line.

& goes before and after the vbNewLine part and each section of text must be enclosed with quotation marks.

Here is the result:


By keeping the contents of the label within the code window for the UserForm, you can add new lines and also manage the text much more easily.

You can also use this method to add text to a label from the worksheet.

Add Text from the Worksheet

You can add text from the worksheet with ease, simply follow the above examples and add some additional code to get a value from Excel.

Label1.Caption = Sheets("Sheet1").Range("A8").Value

Label1 is the name of the Label.

Sheets("Sheet1").Range("A8") is the address of the cell that contains the text to put into the Label. Sheet1 is the name of the worksheet and A8 is the cell.


For small amounts of text, you can use the Caption property from the Properties window; for large amounts of text, or, if you want to make more dynamic sections of text, use a little VBA and it will make your life much easier.

Make sure to download the attached sample file to see these example in Excel. Some examples have been commented out, but they are still there and you can see them and work with them by uncommenting them.

Question? Ask it in our Excel Forum

Downloadable Files: Excel File