listbox clear selections

smakatura

Board Regular
Joined
May 27, 2011
Messages
141
I have tried every possible combination to resolve this issue and can not find an answer. Ia about to pull all my hair out. most of the code I have tried produces an error.

the following code does NOT produce an error...but also does NOTHING.

Code:
Sub Fix_Font_size()

 Sheets("Distribution").OLEObjects("ListBox1").Object.Value = Null
End Sub


can someone please help
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Code:
Sheets("Distribution").OLEObjects("ListBox1").Object.ListIndex = -1
 
Upvote 0
If you are referring to a multiselect listbox then:
Code:
Dim i As Long

With Sheets("Distribution").OLEObjects("ListBox1").Object
    For i = 0 To .ListCount - 1
        .Selected(i) = False
    Next i
End With
 
Upvote 0
This is an ActiveX ListBox with a known name on a known sheet... why are we vectoring through OLEObjects?

Code:
Sheets("Distribution").OLEObjects("ListBox1").Object.ListIndex = -1
Code:
Sheets("Distribution").ListBox1.ListIndex = -1


If you are referring to a multiselect listbox then:
Code:
Dim i As Long

With Sheets("Distribution").OLEObjects("ListBox1").Object
    For i = 0 To .ListCount - 1
        .Selected(i) = False
    Next i
End With
Code:
Dim i As Long

With Sheets("Distribution").ListBox1
    For i = 0 To .ListCount - 1
        .Selected(i) = False
    Next i
End With
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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