ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Export listbox items to worksheet (https://www.excelbanter.com/excel-programming/427555-export-listbox-items-worksheet.html)

Honnore via OfficeKB.com

Export listbox items to worksheet
 
Hi there dear reader...
I have a userform with a listbox.
I would like to export the the items of the listbox into a worksheet.
Here below my code which doesn't work unfortunately. I don't know why.

Dim c As Variant
Dim i As Integer
c = ThisWorkbook.Worksheets("Sheet1").Range("a1:e5")
For i = 0 To ListBox1.ListCount - 1
c(i + 1, 1) = ListBox1.List(i, 1)
Next i

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1


Honnore via OfficeKB.com

Export listbox items to worksheet
 
I found the solution.The here below code works

Dim c As Variant
Dim i As Integer
c = ThisWorkbook.Worksheets("Sheet1").Range("a1:e5")
For i = 0 To ListBox1.ListCount - 1
Cells(i + 1, 1) = ListBox1.List(i, 1)
Next i


Honnore wrote:
Hi there dear reader...
I have a userform with a listbox.
I would like to export the the items of the listbox into a worksheet.
Here below my code which doesn't work unfortunately. I don't know why.

Dim c As Variant
Dim i As Integer
c = ThisWorkbook.Worksheets("Sheet1").Range("a1:e5")
For i = 0 To ListBox1.ListCount - 1
c(i + 1, 1) = ListBox1.List(i, 1)
Next i


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1



All times are GMT +1. The time now is 12:33 AM.

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