I want to show MsgBox of fails with correspondent samples. If non show another MsgBox with no fail.
I feel I am almost there but have something messing.
If I put the MsgBox within the loop the MsgBox appears more than once, if I put it out it shows both MsgBox of "fails" if any and "There are no Fails"
How can I show only one of them with the (If-statement), and of course show once. Either box showing all fails or box showing there are none.
The code I ran:
Sub Box()
Dim x As Long
Dim fails As String
'Dim passes As String
With Sheet2
For x = 2 To 8
If .Range("E" & x).Value > 0.24 Then
fails = fails & ", " & .Range("A" & x)
MsgBox "Failed Strut: " & fails
ElseIf .Range("E" & x).Value < 0.24 Then
passes = "There are no fails"
MsgBox passes
End If
Next x
End With
'Other attempts
'MsgBox passes
'fails = Right(fails, Len(fails) - 2)
'MsgBox "Failed Strut: " & fails
End Sub