lundi 11 février 2019

Compare value of cells

I have a very simple issue (why I cant believe Iam not seeing the mistake). I want to compare a series of cells with each other. If one of them contains any value and the other doesnt, the if statement should be true (so BolPIDEqual = false). Easy enough but when I test it, The if Statemnt never gets true (BolPIDEqual = false) even when the test data isnt the same for both cells/ranges. For Example A1 = "1" and A2 = "" leads to non of the ifs being triggered, but the second if should trigger and set BolPIDEqual to false...

Please help me, i really dont see what Iam doing wrong...

For r = 1 To 5
                 If Worksheets("X").Cells(1, r).Value = "" And Worksheets("X").Cells(2, r).Value = "*?*" Then
                    BolPIDEqual = False
                ElseIf Worksheets("X").Cells(1, r).Value = "*?*" And Worksheets("X").Cells(2, r).Value = "" Then
                    BolPIDEqual = False
                End If
            Next r

Aucun commentaire:

Enregistrer un commentaire