Thank you for Visiting my Blog

Saturday, 15 July 2017

How to extract data from TextBox through VBA


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. 


Below is the few example to extract data from text box:

#1.

Sub textbox1()

Dim Textbox As String

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

‘’’’’’  Highlighted is Text box name’’’’’’’

MsgBox (Textbox)

End Sub

#2.

Sub textbox2()

Dim Textbox As String

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

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

End Sub
Note: Please refer below link to extract data from once cell to multiple cells

No comments:

Post a Comment