Hi,
I have a userform that dynamically hides and unhides columns based on the selections in a listbox. .Selected(0) is "Show All" and the following list items refer to the other columns. I would like to automatically deselect "Show All" when any other list item is selected. Adding .Selected(0) = False into the With nest obviously sends it into a loop and crashes Excel. I know it's simple but I'm struggling to figure it out.
Thanks in anticipation![]()
Private Sub ListBox1_Change() Dim Ndx As Long Application.ScreenUpdating = False With Me.ListBox1 If .Selected(0) Then ActiveSheet.Columns("L:BM").Hidden = False Else For Ndx = 1 To .ListCount - 1 Sheets("Analysis").Columns(Ndx + 11).Hidden = Not .Selected(Ndx) Next Ndx End If End With Application.ScreenUpdating = True End Sub
Bookmarks