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
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