Cannot deselect Listbox item

Trigaz

New Member
Joined
May 23, 2018
Messages
2
Hi there,

I have a single select listbox set up as below.

ListBox1.ColumnCount = 6
ListBox1.ColumnWidths = "60;150;45;45;45;45"
ListBox1.MultiSelect = 0


I populate it with data and then have a check to see if the listbox is clicked (code below). If so I open a separate userform which gives the user options to delete / amend the data. Upon returning to the original userform I set the listindex to -1 (and have confirmed it is happening with a msgbox), but regardless the row in the listbox remains highlighted blue. The event then does not trigger when it is clicked on again.

What am I doing wrong?

Private Sub ListBox1_Click()
Application.EnableEvents = False
Load UserForm6
UserForm6.Show
Me.ListBox1.ListIndex = -1
Me.ListBox1.ListIndex = ListBox1.ListIndex
Application.EnableEvents = True
End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,215,457
Messages
6,124,941
Members
449,198
Latest member
MhammadishaqKhan

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