Adding data from multiple cells to a textbox one after the other?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

So I have this macro that adds the data from one cell into a text box, is it possible to add more than one to make a list

Code:
[FONT=Calibri][SIZE=3][COLOR=#000000]Su[LEFT][COLOR=#000000][FONT=Calibri][/FONT][/COLOR][COLOR=#000000][FONT=Calibri]UserForm1.TextBox1.Value = Sheets("Form Info").Range("A1").Value[/FONT][/COLOR][/LEFT]b AAA_Calender1_tests()
[LEFT][COLOR=#000000][FONT=Calibri][/FONT][/COLOR][COLOR=#000000][FONT=Calibri]UserForm1.TextBox1.Value = Sheets("Form Info").Range("A1").Value[/FONT][/COLOR][/LEFT]<strike></strike>
[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]      UserForm1.Show[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]End Sub[/COLOR][/SIZE][/FONT]

So instead of A1 it would be A1:A20 under each other?

thanks

Tony
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
So I have this macro that adds the data from one cell into a text box, is it possible to add more than one to make a list

Code:
[FONT=Calibri][SIZE=3][COLOR=#000000]Su[LEFT][COLOR=#000000][FONT=Calibri][/FONT][/COLOR][COLOR=#000000][FONT=Calibri]UserForm1.TextBox1.Value = Sheets("Form Info").Range("A1").Value[/FONT][/COLOR][/LEFT]b AAA_Calender1_tests()
[LEFT][COLOR=#000000][FONT=Calibri][/FONT][/COLOR][COLOR=#000000][FONT=Calibri]UserForm1.TextBox1.Value = Sheets("Form Info").Range("A1").Value[/FONT][/COLOR][/LEFT]<strike></strike>
[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]      UserForm1.Show[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]End Sub[/COLOR][/SIZE][/FONT]

So instead of A1 it would be A1:A20 under each other?
Assuming the MultiLine and WordWrap properties of the TextBox are both set to True and, if needed, the ScrollBars property is set to fmScrollBarsVertical, give this macro a try...
Code:
[table="width: 500"]
[tr]
	[td]Sub AAA_Calender1_tests()
  UserForm1.TextBox1.Value = Join(Application.Transpose(Sheets("Form Info").Range("A1:A20")), vbLf)
  UserForm1.Show
End Sub[/td]
[/tr]
[/table]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top