Hello, I have this function that stopped working when I added the line "If ctrl.Visible = True Then".
the function checks all controls on a userform to see if it is filled. I have a bunch of them invisible depending on user selection in another combobox. I need the function to ignore those hidden ones because they won't be filled.
can someone please help me fix it? Thanks in advance!
![]()
Private Function EverythingFilledIn() As Boolean Dim AnythingMissing As Boolean EverythingFilledIn = True Dim ctl As MSForms.Control For Each ctl In Controls If ctrl.Visible = True Then If TypeOf ctl Is MSForms.TextBox Or TypeOf ctl Is MSForms.ComboBox Then If ctl.Value = "" Then ctl.BackColor = rgbPink If Not AnythingMissing Then ctl.SetFocus AnythingMissing = True EverythingFilledIn = False End If End If End If Next ctl End Function
Bookmarks