B
Barry Pettis
I have a user form with 200+ controls. On various
listboxes I want the user to be able to use Ctrl + A to
select all values and Ctrl + U to deselect all values. I
also want the user to be able to use Shift + ArrowUp and
Shift + ArrowDown to move the selections up and down in
the list.
One listbox contains the following code:
ByVal Shift As Integer)
' Local Variables
' Step 1 : User selects 'ESC' key
If KeyCode = 27 Then Unload Me
' Step 2 : Ctrl - A = select all ; Ctrl -U = deselect all
If Shift = 2 Then
If KeyCode = 65 Then Call SelectAllItems
(Me.lboWorkStationNames, True)
If KeyCode = 85 Then Call SelectAllItems
(Me.lboWorkStationNames, False)
End If
End Sub
Which works great. It does everything that I want it to.
On another listbox the following code is present:
Private Sub lboUpdWkStation_SelStations_KeyDown(ByVal
KeyCode As MSForms.ReturnI
nteger, ByVal Shift As Integer)
'
' Step 2 : Ctrl - A = select all ; Ctrl -U = deselect all
If KeyCode = 65 Or KeyCode = 85 And Shift = 2 Then
If KeyCode = 65 Then Call SelectAllItems
(Me.lboUpdWkStation_SelStations,
True)
If KeyCode = 85 Then Call SelectAllItems
(Me.lboUpdWkStation_SelStations,
False)
End If
End Sub
Both codes are identical in all aspects except for the
name of the control.
The problem that I get is during run time. The first
listed form runs without issue. However, when attempting
to perform the various functions on the second form
nothing happens. I've tried putting a MsgBox line in to
trap the error so that I can see where it stops but the
event doesn't even get triggered.
The VBE properties is locked upon opening of the workbook,
and the problem above happens at this time. Now if I
unlock the code It works just fine.
Does anybody have any ideas. Short of making multiple
forms to reduce the forms control count. Is there a limit
on size that VBA can compile / run?
Please let me know.
my work e-mail = (e-mail address removed) ( no attachements )
my home e-mail = (e-mail address removed)
Thanks
listboxes I want the user to be able to use Ctrl + A to
select all values and Ctrl + U to deselect all values. I
also want the user to be able to use Shift + ArrowUp and
Shift + ArrowDown to move the selections up and down in
the list.
One listbox contains the following code:
ByVal Shift As Integer)
' Local Variables
' Step 1 : User selects 'ESC' key
If KeyCode = 27 Then Unload Me
' Step 2 : Ctrl - A = select all ; Ctrl -U = deselect all
If Shift = 2 Then
If KeyCode = 65 Then Call SelectAllItems
(Me.lboWorkStationNames, True)
If KeyCode = 85 Then Call SelectAllItems
(Me.lboWorkStationNames, False)
End If
End Sub
Which works great. It does everything that I want it to.
On another listbox the following code is present:
Private Sub lboUpdWkStation_SelStations_KeyDown(ByVal
KeyCode As MSForms.ReturnI
nteger, ByVal Shift As Integer)
'
' Step 2 : Ctrl - A = select all ; Ctrl -U = deselect all
If KeyCode = 65 Or KeyCode = 85 And Shift = 2 Then
If KeyCode = 65 Then Call SelectAllItems
(Me.lboUpdWkStation_SelStations,
True)
If KeyCode = 85 Then Call SelectAllItems
(Me.lboUpdWkStation_SelStations,
False)
End If
End Sub
Both codes are identical in all aspects except for the
name of the control.
The problem that I get is during run time. The first
listed form runs without issue. However, when attempting
to perform the various functions on the second form
nothing happens. I've tried putting a MsgBox line in to
trap the error so that I can see where it stops but the
event doesn't even get triggered.
The VBE properties is locked upon opening of the workbook,
and the problem above happens at this time. Now if I
unlock the code It works just fine.
Does anybody have any ideas. Short of making multiple
forms to reduce the forms control count. Is there a limit
on size that VBA can compile / run?
Please let me know.
my work e-mail = (e-mail address removed) ( no attachements )
my home e-mail = (e-mail address removed)
Thanks