silentwolf
Well-known Member
- Joined
- May 14, 2008
- Messages
- 1,216
- Office Version
- 2016
Hi guys I am stuck again...
I got a single select Listbox and a multiselect listbox in a userform.. and other controls like txtboxes and comboxes..
following code I have to prevent the user to
Also I found a similar thread here wich works when there is on multiselect listbox in the form
In the userform I have the btnOk property set to false
Now how I would need to change this so the btnOk is enabled = false until all controls including multiselect control and single select control are selected.
Hope someone could help me with this.
Many thanks
Albert
I got a single select Listbox and a multiselect listbox in a userform.. and other controls like txtboxes and comboxes..
following code I have to prevent the user to
Code:
Sub Test
Dim ctl As MSForms.Control
Dim lItem As Long
'Validate whether all boxes are completed
For Each ctl In frmEintrag.EintragPages(EintragPages.Value).Controls
If (TypeName(ctl) = "TextBox") Or (TypeName(ctl) = "ComboBox") Or (TypeName(ctl) = "Listbox") Then
If ctl.Value = "" Then
MsgBox ("Nicht alle Informationen sind gegeben. Bitte eintragen!"), vbCritical + vbOKOnly, p_cstrAppMeldung
Exit Sub
End If
End If
Next ctl
End sub
Also I found a similar thread here wich works when there is on multiselect listbox in the form
Code:
Private Sub lstObjekte_Click()
Dim booSelected As Boolean
Dim intCounter As Integer
With lstMitarbeiter
For intCounter = 0 To .ListCount - 1
booSelected = booSelected And .Selected(intCounter)
Next intCounter
End With
If Not booSelected Then
MsgBox "No selection in Listbox"
End If
End Sub
In the userform I have the btnOk property set to false
Now how I would need to change this so the btnOk is enabled = false until all controls including multiselect control and single select control are selected.
Hope someone could help me with this.
Many thanks
Albert