ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   List Box and length (https://www.excelbanter.com/excel-programming/275638-list-box-length.html)

Ten

List Box and length
 
Hi,
I need to get a way to figure out hos many items I have in
a Listbox, to loop through all and get the values from it.
Can anybody help?

Here is my code - I would like my "i" to get the number of
items, and then loop through all of them later.:

Set myWb = ActiveWorkbook
Set myWsBudGrunnlag = myWb.Worksheets.Item
("Budget")
Set myWsNokkeltall = myWb.Worksheets.Item
("KeeFigures")

Dim cboEiendom As Object
Set cboEiendom = myWsBudGrunnlag.Shapes.Item
(1).OLEFormat.Object.Object
Dim i
i = 100 ' This is the integer i would like to set
equal the number of items in the Listbox called
cboEiendom, for looping through under

Dim j
For j = 1 To i

strEiendom = cboEiendom.List(j - 1)
myWsNokkeltall.Cells(j + 2, iColEiendom).Value
= strEiendom

' Some more code...

Next j


Please advice, thx!

Best regrads,
Tor Erik


All times are GMT +1. The time now is 09:00 AM.

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