ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel - count sleected items in a listbox (https://www.excelbanter.com/excel-programming/285620-excel-count-sleected-items-listbox.html)

sjvenz[_5_]

excel - count sleected items in a listbox
 
Is it possible to count the SELECTED items of a ListBox


---
Message posted from http://www.ExcelForum.com/


Greg Wilson[_4_]

excel - count sleected items in a listbox
 
Try:

Sub CountSelected()
Dim LB As ListBox, i As Integer
Dim X As Integer
X = 0
Set LB = ActiveSheet.OLEObjects(1).Object
For i = 1 To LB.ListCount
If LB.Selected(i - 1) = True Then X = X + 1
Next
MsgBox X
End Sub

Regards,
Greg

-----Original Message-----
Is it possible to count the SELECTED items of a ListBox


---
Message posted from http://www.ExcelForum.com/

.



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

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