ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   List Data to Single String (https://www.excelbanter.com/excel-programming/311523-list-data-single-string.html)

asmenut

List Data to Single String
 
Is there a way that I can take the data from a ListBox (12 items) and load
into a merged cell as a single string

ListBox1 data
Cake
Ice Cream to Cake / Ice Cream /
Pies / Cookies
Pies
Cookies


Tom Ogilvy

List Data to Single String
 
With Userform1.Listbox
for i = 0 to .listcount - 1
if i < .listcount - 1 then
sStr = sStr & .list(i) & " / "
else
sStr = sStr & .List(i)
end if
Next
End With
' now assign to the cell in the upper left corner
' of the merged cell area

Range("B9").Value = sStr

--
Regards,
Tom Ogilvy

"asmenut" wrote in message
...
Is there a way that I can take the data from a ListBox (12 items) and load
into a merged cell as a single string

ListBox1 data
Cake
Ice Cream to Cake / Ice Cream /
Pies / Cookies
Pies
Cookies





All times are GMT +1. The time now is 08:05 AM.

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