Cannot deselect a row in a listbox

dogdays

Active Member
Joined
Apr 28, 2008
Messages
434
Office Version
  1. 2007
ACCESS 207 win7 64bit
I wish to deselect all rows in a listbox that are selected(highlighted).
I tried this but no joy.
Code:
        For iIndex = 0 To Me.lsbSupportCodes.ListCount - 1
            Me.lsbSupportCodes.Selected(iIndex) = False
        Next iIndex
Any advice appreciated.

tia Jack
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
For listbox on a form; vba in Excel: try:

Code:
Me.lsbSupportCodes.List = Me.lsbSupportCodes.List

(I did not ry ACCESS):
 
Upvote 0
Thanks for the response.
I tried you suggestion, did not compile, does not like .list.

Jack
 
Upvote 0
Is it an extended multiselect or simple multiselect? What kind of rowsource?
 
Upvote 0
Simple multiselect, just figured it out.
me.lsbSupportCodes = Null

thx
 
Upvote 0
I believe Xenou is on the right track. If your list box Multi-select property is not Simple or Extended, your code will simply shift the selection to the next item in the loop. You probably find that when you run it, the last item is selected (or none if you click to select none, which should work regardless of the property setting). Change the setting on the Other tab of the property sheet for the list box to whichever of the other two properties suits your application. Press F1 on any property to get an explanation of it.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,816
Messages
6,162,148
Members
451,746
Latest member
samwalrus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top