-1

In my macro, I have 2 string arrays: NewMsg () and MyData(). Later in the code, I extract a table and split the data to build the NewMsg array. Then in my code, I compare NewMsg (x) to MyData (Y) and do something if they match. I element of each array is "E-109988". I step through the code and find that the 2 elements appear to be the same. However, the macro doesn't recognize it as a match so it ends up producing an error. Is there some formatting or something on 1 of the elements that don't cause them to match? thanks for the help........

Shaves
  • 884
  • 5
  • 16
  • 46
  • 1
    Can you convert them to strings using CStr(variablename)? Im not sure this works BTW its just an idea – Doug Coats Jan 18 '17 at 23:08
  • 2
    1) We can't tell you why your code isn't working if we can't see the code. 2) *it ends up producing an error* is an absolutely useless problem description unless you tell us what **error** is produced. It's on your screen right in front of you, so there's no reason for you not to share that info with us. 3) See [Is floating point math broken?](http://stackoverflow.com/q/588004/62576) for the reasons you can't compare floating point numbers easily. – Ken White Jan 18 '17 at 23:12

1 Answers1

1

Perhaps dimensioning them either as a string or variant (and not both) makes a difference. On top of that if you absorb the "string" arrays from cells, you might want to (manually or programatically) check if the datatype of the cells are identical, on top of the content.

(rmb>cell properties>type> select text or whatever suits your needs, just to ensure that is not the problem)

a.t.
  • 2,002
  • 3
  • 26
  • 66
  • I added the following lines: – Shaves Jan 19 '17 at 16:49
  • 1
    NewMsg(a) = Replace(NewMsg(a), Chr(10), "") NewMsg(a) = Replace(NewMsg(a), Chr(13), "") – Shaves Jan 19 '17 at 16:49
  • and that did the trick. There was something that was attached to the NewMsg variable that was created by splitting some data that was extracted. Thanks for the help....... – Shaves Jan 19 '17 at 16:50