Hi,
Can someone help me with this issue please. I'm searching for ages.
My code goes to 'else' when e = 15. At row 15, there is a number/text (C15) that needs to be equal to another number/text (L15). (6002559)
When the 'do while' hits e=15 the condition er=et is FALSE, so it goes to 'else' msgbox.
This is really weird because the cells in excel contains both number 6002559. So it should be TRUE
But when cell L15 becomes a variable, the quotation marks wil be removed by VBA. So, that means the conditions is indeed FALSE. VBA does what it needs to do but....
Why are the quotation marks gone? Something causes that number 6002559 wil be save as variable as 6002559 and not as "6002559". All the other data in column L does have quotations marks when these cells become a variable.
So like I said, the other rows will pass the condition er=et. Is this because it is not a number?
Then it is still strange because cell C15 becomes the value of variable 'et' as well and this value does contains the quotations marks and is also a number. see attached.
Let me know if you have any questions.
Here is the code and the images attached.
Can someone help me with this issue please. I'm searching for ages.
My code goes to 'else' when e = 15. At row 15, there is a number/text (C15) that needs to be equal to another number/text (L15). (6002559)
When the 'do while' hits e=15 the condition er=et is FALSE, so it goes to 'else' msgbox.
This is really weird because the cells in excel contains both number 6002559. So it should be TRUE
But when cell L15 becomes a variable, the quotation marks wil be removed by VBA. So, that means the conditions is indeed FALSE. VBA does what it needs to do but....
Why are the quotation marks gone? Something causes that number 6002559 wil be save as variable as 6002559 and not as "6002559". All the other data in column L does have quotations marks when these cells become a variable.
So like I said, the other rows will pass the condition er=et. Is this because it is not a number?
Then it is still strange because cell C15 becomes the value of variable 'et' as well and this value does contains the quotations marks and is also a number. see attached.
Let me know if you have any questions.
Here is the code and the images attached.
VBA Code:
Application.ErrorCheckingOptions.NumberAsText = False
'-----------------------------------
Dim e As Integer
e = 2
Do While Worksheets("ZANRIC").Cells(e, 1).Value <> ""
Dim er As Variant
er = Worksheets("ZANRIC").Cells(e, 12).Value
Dim et As Variant
et = Worksheets("ZANRIC").Cells(e, 3).Value
If er = et _
Then
Else
MsgBox "ARTICLENUMBERS DO NOT MATCH ERROR"
GoTo Forward01
End If
e = e + 1
Loop