Hello,
I am trying to loop through a group of TextBoxes. If the TextBox contains the string "FAIL" in it then the next line of code should execute. But I seem to be doing something wrong . I figured that I could use an array to accomplish this. Below is what I have so far...
Thank you!
strTxt1 = Me.txtNotes1.Text
strTxt2 = Me.txtNotes2.Text
strTxt3 = Me.txtNotes3.Text
strTxt4 = Me.txtNotes4.Text
strTxt5 = Me.txtNotes5.Text
strTxt6 = Me.txtNotes6.Text
strTxt7 = Me.txtNotes7.Text
strTxt8 = Me.txtNotes8.Text
strTxt9 = Me.txtNotes9.Text
strTxt10 = Me.txtNotes10.Text
strTxt11 = Me.txtNotes11.Text
strTxt12 = Me.txtNotes12.Text
strTxt13 = Me.txtNotes13.Text
strTxt14 = Me.txtNotes14.Text
strTxt15 = Me.txtNotes15.Text
strTxt16 = Me.txtNotes16.Text
strTxt17 = Me.txtNotes17.Text
strTxt18 = Me.txtNotes18.Text
strTxt19 = Me.txtNotes19.Text
strTxt20 = Me.txtNotes20.Text
strTxt21 = Me.txtNotes21.Text
strTxt22 = Me.txtNotes22.Text
Dim strTxtArry As Variant
Dim i As Integer
strTxtArry = Array(strTxt1, strTxt2, strTxt3, strTxt4, strTxt5, strTxt6, strTxt7, strTxt8, strTxt9, strTxt10, strTxt11, strTxt12, strTxt13, strTxt14, strTxt15, strTxt16, strTxt17, strTxt18, strTxt19, strTxt20, strTxt21, strTxt22)
For i = 0 To UBound(strTxtArry)
If InStr("FAIL", strTxtArry(i)) Then
'Code Goes Here
Next i
Bookmarks