Maybe this would work for you.
Userform with a listbox, commandbutton and label.
Click button to toggle 'lock' listbox selection.
You can select items when unlocked.
You can scroll list whether locked or not.
Private m_blnLocked As Boolean
Private m_vntSelected() As Variant
Private m_lngListIndex As Long
Private Sub CommandButton1_Click()
m_blnLocked = Not m_blnLocked
Label1.Caption = m_blnLocked
End Sub
Private Sub ListBox1_Change()
If m_blnLocked Then
m_lngListIndex = ListBox1.ListIndex
ListBox1.Selected(ListBox1.ListIndex) = m_vntSelected(ListBox1.ListIndex)
Else
m_lngListIndex = ListBox1.ListIndex
If ListBox1.ListIndex >= 0 Then
m_vntSelected(ListBox1.ListIndex) = ListBox1.Selected(ListBox1.ListIndex)
End If
End If
End Sub
Private Sub UserForm_Initialize()
ListBox1.List = Array(1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8, 9)
ListBox1.MultiSelect = fmMultiSelectMulti
ReDim m_vntSelected(0 To ListBox1.ListCount - 1)
m_blnLocked = False
m_lngListIndex = -1
End Sub
Bookmarks