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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

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