Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to check for blank responses
I thought I would repost my question as I have not been able to figure this
one out. I am using the code to check multiple controls on a single page of a multipage userform. I have attached the code to a "Next" command button. While the code that checks text boxes and comboboxes works well, the problem is the grouped controls like Optionbuttons. I get a "Run-Time Error 438" "Object doesn't support this property or method." occurring at the "Select Case ctrl.GroupName" line in the code. Here is the code for checking blanks as it is now: Dim cnt1 As Long, cnt2 As Long Dim bOp1 As Boolean, bOp2 As Boolean cnt1 = 0: cnt2 = 0 bOp1 = False: bOp2 = False Index = CMTAudit.AuditDataMultipage.Value For Each ctrl In CMTAudit.AuditDataMultipage.Pages(Index).Controls 'MsgBox ctrl.Name If TypeOf ctrl Is MSForms.TextBox Then If ctrl.Text = "" Then MsgBox "Missing answer, please complete" ctrl.SetFocus Exit For End If ElseIf TypeOf ctrl Is MSForms.ComboBox Then If ctrl.Text = "" Then MsgBox "Missing answer, please complete" ctrl.SetFocus Exit For End If End If Next ctrl For Each ctrl In CMTAudit.AuditDataMultipage.Pages(Index).Controls Select Case ctrl.GroupName Case "DoubleID" cnt1 = cnt1 + 1 If ctrl.Value Then bOp1 = True If cnt1 = 3 Then If Not bOp1 Then MsgBox "Question Missed, Please Answer" ctrl.SetFocus Exit For End If End If Case "FallMeasures" cnt2 = cnt2 + 1 If ctrl.Value Then bOp2 = True If cnt2 = 5 Then If Not bOp2 Then MsgBox "Question Missed, Please Answer" ctrl.SetFocus Exit For End If End If End Select Next ctrl End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Blank Check? | Excel Worksheet Functions | |||
Check for Non Blank and Blank Cells Before Save | Excel Discussion (Misc queries) | |||
Macro to check if clipboard is blank. | Excel Discussion (Misc queries) | |||
Check for blank clipboard | Excel Discussion (Misc queries) | |||
Check if (part of) a row is blank. | Excel Programming |