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

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
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 Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,215,079
Messages
6,123,000
Members
449,092
Latest member
masterms

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