ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ListBox Item Row Number (https://www.excelbanter.com/excel-programming/447160-listbox-item-row-number.html)

Laurence Lombard

ListBox Item Row Number
 
Is there an easy way to find the sourcelist row number of a listbox
item. Something like Rownumber = ListBox1.Row

One way would be to have a helper column with all the row numbers and
use that column as the BoundColumn, but I was wondering if there was
something more direct

Thanks
Laurence

GS[_2_]

ListBox Item Row Number
 
Laurence Lombard formulated the question :
Is there an easy way to find the sourcelist row number of a listbox item.
Something like Rownumber = ListBox1.Row

One way would be to have a helper column with all the row numbers and use
that column as the BoundColumn, but I was wondering if there was something
more direct

Thanks
Laurence


Listbox uses the ListIndex property for the position of a selected
item. Note that this is zero-based and so...

RowNumber = ListBox1.ListIndex + 1

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




All times are GMT +1. The time now is 08:30 PM.

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