How to display the content of a column in the textbox
Solved
Lynda_123
-
Lynda_123 -
Lynda_123 -
Good evening,
Please, I would like to know how to display the content of a column in a textbox.
Thank you in advance for your answers.
Please, I would like to know how to display the content of a column in a textbox.
Thank you in advance for your answers.
Related links:
- Display filling one column based on another column
- How to display the content of an Excel sheet using VBA UserForm
- Copy the content of a cell into a comment using a macro
- Search Textbox Value in a Column (Excel)
- If value in column A, display content in same row column B
- Value of a textbox in a cell with decimal number format
3 answers
-
Good evening,
Here is a piece of code to achieve what you asked for:
Private Sub UserForm_Activate() TextBox1.Value = "" For Each valeur In Range("a1:a7") 'Adapt according to the number of rows and the letter of your column TextBox1.Value = TextBox1.Value & Cells(valeur.Row, 1) & vbCr Next valeur End Sub
WARNING: remember to set "multiline" to TRUE in your textbox properties
Hope this works for you
Good night -
Hello,
here is the explanation:Private Sub UserForm_Activate() TextBox1.Value = "" 'empties the textbox each time the userform loads (at least it's always updated) For Each value In Range("a1:a7") 'To be adapted according to the number of rows and the letter of your column TextBox1.Value = TextBox1.Value & Cells(value.Row, 1) & vbCr 'fills the textbox by retrieving the value found there and adding the new 'value (next cell in column "A") and adds a line break (vbCr) Next value End Sub
Good evening -