I am having a problem with comparing two strings. The method does not seem to work somehow. I have tried the following to functions:
Method:
If StrComp(logic_string, RSTA_ISIN_clean) Then rng.Offset(0, 16) = "OK(ISIN in RSTA)" rng.Offset(0, 16).Interior.Color = 5296274 Else rng.Offset(0, 16) = "NG(ISIN not RSTA or check RSTA)" rng.Offset(0, 16).Interior.Color = 255 End IfMethod:
If InStr(1, RSTA_ISIN_clean, logic_string, vbTextCompare) Then rng.Offset(0, 16) = "OK(ISIN in RSTA)" rng.Offset(0, 16).Interior.Color = 5296274 Else rng.Offset(0, 16) = "NG(ISIN not RSTA or check RSTA)" rng.Offset(0, 16).Interior.Color = 255 End If
in logic_string I have the value "FR0012915700" and in RSTA_ISIN i have the value = " Old ISIN: FR0012915700"
All I am trying to do is to check if RSTA_ISIN is in logic_string and if so i want to write OK in cell. (trying to get a contains method here)
It can be that something is wrong with logic_string as it sometimes gives me spaces -> so logic_string looks like this in debug mode " FR0004052561" -> I tried to trim the spaces with Trim but that doesn't work either.
I have also tried the InStr function but that doesn't work either
Can someone assist please
This is what I get in debug mode:
