mardi 15 janvier 2019

If Statement within a For Loop and Outputs

I'm trying to create code that will go through cells within a column that either have "yes", "no", or "". I need to it output "yes" in a different cell if there are no "no"'s and output "no" if there is just one "no".

My code is giving me the output of "Yes" even if there is a "No"

For i = 26 To 33
        If Worksheets("Calculations").Cells(i, 8) = "Yes" Or 
Worksheets("Calculations").Cells(i, 8) = "No Requirement" Then
            Worksheets("Calculations").Range("H33").Value = "Yes"
        Else
            Worksheets("Calculations").Range("H33").Value = "No"
        End If
    Next i  

Output either "yes" or "no" depending

Aucun commentaire:

Enregistrer un commentaire