First I would try cleaning the data of all non-printable characters.
In Cell B1, type the formula "=Clean(A1)" and copy this down to the
last data row. Then copy and paste column B as values, and then replace
column A with the cleaned-up data in column B.
Then if that still gives the type-mismatch error, you could look for the failure point.
Add this line
Insert this line just after the "For j =..." line:
Run the code again and see what the value is in column E of your worksheet.
Let's say it reached 935 before the macro fails. Run the macro again and see if
you get the same result in column E. If you do, then put this code just inside the For loop:
and set a debug break point on the line "lngTest = lngTest".
Step through the code in debug and identify the line of code that fails and
what the value of the variable j is at that point, which may give some
insight about the offending cell of data.
Stop the macro and run it again to the point where you go into debug, then step
through to the point just before the failure and examine in a Watch window the value
that is in the cell being read. It may be data that does not want to be treated as text.
Bookmarks