Hi
I am a beginner to VBA! I am trying to write a module that checks the content of six unbound text boxes, defined in an array. If the boxes do not contain any content, I wish to prompt the user to enter content. My code is:
Private Sub Submit_Click()
Dim DefectType(0 To 5) As String
DefectType(0) = "SurfaceBox"
DefectType(1) = "MarkingsBox"
DefectType(2) = "LightingBox"
DefectType(3) = "FenceBox"
DefectType(4) = "GatesBox"
DefectType(5) = "OtherBox"
Dim x As Integer
For MyCounter = 0 To 5
If DefectType(MyCounter).Value = "" Then
x = MsgBox("Please indicate whether " & DefectType(MyCounter) & " is satisfactory or not and describe any defect", vbOKOnly)
End If
Next
End Sub
I've tried loads of variations on the theme but keep getting an error: "Invalid qualifier".
Thanks for any help
I am a beginner to VBA! I am trying to write a module that checks the content of six unbound text boxes, defined in an array. If the boxes do not contain any content, I wish to prompt the user to enter content. My code is:
Private Sub Submit_Click()
Dim DefectType(0 To 5) As String
DefectType(0) = "SurfaceBox"
DefectType(1) = "MarkingsBox"
DefectType(2) = "LightingBox"
DefectType(3) = "FenceBox"
DefectType(4) = "GatesBox"
DefectType(5) = "OtherBox"
Dim x As Integer
For MyCounter = 0 To 5
If DefectType(MyCounter).Value = "" Then
x = MsgBox("Please indicate whether " & DefectType(MyCounter) & " is satisfactory or not and describe any defect", vbOKOnly)
End If
Next
End Sub
I've tried loads of variations on the theme but keep getting an error: "Invalid qualifier".
Thanks for any help