ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   List Box Macro (https://www.excelbanter.com/excel-programming/393204-list-box-macro.html)

Alpur

List Box Macro
 
Hi All,

I have a List Box to which I have assigned a macro. Can I do some sort of
loop that will run through all entries in the list box running the macro as
it goes?

Many thanks,

Al.

joel

List Box Macro
 
This code adds items and then displays the items

Private Sub ListBox1_Click()

'add number to list box
For i = 1 To 10

ListBox1.AddItem i
Next i

ListBoxCount = ListBox1.ListCount
For i = 1 To ListBoxCount

MsgBox (ListBox1.List(i))
Next i
End Sub

"Alpur" wrote:

Hi All,

I have a List Box to which I have assigned a macro. Can I do some sort of
loop that will run through all entries in the list box running the macro as
it goes?

Many thanks,

Al.



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

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