ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Values from a ListBox (https://www.excelbanter.com/excel-programming/339737-values-listbox.html)

CG Rosén

Values from a ListBox
 
Good Day Group,

How to do a "short" code that picks the text in
the first Column of a ListBox (that has unknown rows).
The picked text will be used in a For Next loop from
ListBox Row(1) to the end.

Brgds

CG Rosén



Harald Staff

Values from a ListBox
 
Hi GC

Private Sub CommandButton1_Click()
Dim S As String
Dim L As Long
For L = 0 To ListBox1.ListCount - 1
S = S & ListBox1.List(L, 0) & vbNewLine
Next
MsgBox S
End Sub


HTH. Best wishes Harald

"CG Rosén" skrev i melding
...
Good Day Group,

How to do a "short" code that picks the text in
the first Column of a ListBox (that has unknown rows).
The picked text will be used in a For Next loop from
ListBox Row(1) to the end.

Brgds

CG Rosén






All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com