ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Whole List or Items in List Box (https://www.excelbanter.com/excel-programming/424292-select-whole-list-items-list-box.html)

K[_2_]

Select Whole List or Items in List Box
 
Hi all, I need macro on a button which can select all the items or
list in ListBox1. Please can any friend can help.

Bob Phillips[_3_]

Select Whole List or Items in List Box
 
Dim i As Long

With Me.ListBox1

.MultiSelect = fmMultiSelectExtended
For i = 1 To .ListCount

.Selected(i - 1) = True
Next i
End With


--
__________________________________
HTH

Bob

"K" wrote in message
...
Hi all, I need macro on a button which can select all the items or
list in ListBox1. Please can any friend can help.




K[_2_]

Select Whole List or Items in List Box
 
On Feb 18, 10:32*am, "Bob Phillips" wrote:
Dim i As Long

* * With Me.ListBox1

* * * * .MultiSelect = fmMultiSelectExtended
* * * * For i = 1 To .ListCount

* * * * * * .Selected(i - 1) = True
* * * * Next i
* * End With

--
__________________________________
HTH

Bob

"K" wrote in message

...



Hi all, *I need macro on a button which can select all the items or
list in ListBox1. *Please can any friend can help.- Hide quoted text -


- Show quoted text -


Thanks lot Bob.

K[_2_]

Select Whole List or Items in List Box
 
On Feb 18, 10:32*am, "Bob Phillips" wrote:
Dim i As Long

* * With Me.ListBox1

* * * * .MultiSelect = fmMultiSelectExtended
* * * * For i = 1 To .ListCount

* * * * * * .Selected(i - 1) = True
* * * * Next i
* * End With

--
__________________________________
HTH

Bob

"K" wrote in message

...



Hi all, *I need macro on a button which can select all the items or
list in ListBox1. *Please can any friend can help.- Hide quoted text -


- Show quoted text -


Bob do you know that what sort of adjusment I should make in your
macro if I want to select all the items or list in ListBox1 except the
last item

Harald Staff[_2_]

Select Whole List or Items in List Box
 

"K" wrote in message
...
On Feb 18, 10:32 am, "Bob Phillips" wrote:
Dim i As Long

With Me.ListBox1

.MultiSelect = fmMultiSelectExtended
For i = 1 To .ListCount

.Selected(i - 1) = True
Next i
End With

--
__________________________________
HTH

Bob

"K" wrote in message

...



Hi all, I need macro on a button which can select all the items or
list in ListBox1. Please can any friend can help.- Hide quoted text -


- Show quoted text -


Bob do you know that what sort of adjusment I should make in your
macro if I want to select all the items or list in ListBox1 except the
last item

For i = 1 To .ListCount - 1

HTH. Best wishes Harald


K[_2_]

Select Whole List or Items in List Box
 
On Feb 18, 2:18*pm, "Harald Staff" wrote:
"K" wrote in message

...
On Feb 18, 10:32 am, "Bob Phillips" wrote:





Dim i As Long


With Me.ListBox1


.MultiSelect = fmMultiSelectExtended
For i = 1 To .ListCount


.Selected(i - 1) = True
Next i
End With


--
__________________________________
HTH


Bob


"K" wrote in message


....


Hi all, I need macro on a button which can select all the items or
list in ListBox1. Please can any friend can help.- Hide quoted text -


- Show quoted text -


Bob do you know that what sort of adjusment I should make in your
macro if I want to select all the items or list in ListBox1 except the
last item

For i = 1 To .ListCount - 1

HTH. Best wishes Harald- Hide quoted text -

- Show quoted text -


thanks Harald


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

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