The text box is the element on a form that allows you to enter data in the user application. You can use input from the text box in your Visual Basic for Application (VBA) procedure. An Excel VBA text box is an empty field on a worksheet that you can fill in with the text. The VBA for Excel text box control includes design properties that gives you the ability to set the font, color of the background and the type of the box border.
Click "Start," "Microsoft Visual Basic for Applications."
Enter the following code in the open window:
' Macro1 Macro
Dim chtTemp As Chart
Dim objTemp As Object
Set chtTemp = ActiveSheet.ChartObjects(1).Chart
Set objTemp = chtTemp.Shapes.AddTextbox
(msoTextOrientationHorizontal, 1, 1, 150, 20)
Selection.Formula = "='" & chtTemp.Parent.Parent.Name & "'!A1"
Click "File," "Save" to add the VBA script to your spreadsheet application.
- Photo Credit Photodisc/Photodisc/Getty Images
How to Add a Second Y-Axis to a Graph in Microsoft Excel
Use Microsoft Excel 2013's Combo Chart option to overlay a second Y-axis to your graph to simultaneously display related data.
How to Read a VBA Code in Microsoft Excel
VBA (Visual Basic for Applications) code is part of most of the Microsoft Office applications. Learning to read the code involves understanding...
How to Use VBA Codes in Excel
Visual Basic for Applications (VBA) is a programming language you can use to tailor Microsoft Office applications to fit your specific needs....
How to Create a VB6 Program for a Bar Code Scanner
Visual Basic, with its object-oriented coding structure, usually needs a programmer to write coding to perform a task. However, since a bar...
How To Display Values In a Textbox In Visual Basic
Text boxes in a user interface are often used to get information from the user, but they can also be used to...
VBA Code for Auto Fill in Excel
Learning to use VBA to run Excel's AutoFill command lets you create a commonly-occurring numeric or text series with a single mouse...
How to Create a Message Box in Excel VBA
Create a message box based on visual base codes, or VBA's, in Excel by going to tools and then selecting macros. Create...