Thank you for Visiting my Blog

Friday, 21 July 2017

How to Copy data into a Text box through Macro


TextBox :

TextBox is used to display data, edit data, etc in the rectangular box. The Textbox can be linked to a Worksheet Cell. The TextBox can have static and dynamic value. When data or text is static in the TextBox field, it represents the read only information. It can be used on the WorkSheet or UserForm. You can see how it works and more details about ActiveX TextBox Control on the UserForm or Worksheet in the following chapter.

The below code is useful if Textbox is already available .

One way to create Textbox is Go to Insert Tab -> Shapes -> Basic Shapes ->


 

 

Sub textbox1()

Dim Textbox As String

Textbox = ThisWorkbook.Worksheets("Main").Cells(1, 1).Value

ActiveSheet.Shapes("Textbox 1").TextFrame.Characters.Text = Textbox

ActiveSheet.Shapes.Range(Array("TextBox 1")).Select

    With Selection.ShapeRange.TextFrame2.TextRange.Font

        .NameComplexScript = "Algerian"

        .NameFarEast = "Algerian"

        .Name = "Algerian"

    End With

    Selection.ShapeRange.TextFrame2.TextRange.Font.Size = 18

End Sub

 
 
 

No comments:

Post a Comment