Type mismatch error

Saqib Husain, Syed
Saqib Husain, Syed used Ask the Experts™
on
I am getting a type mismatch error on this location. I have no idea what could cause this error. Can anyone help me just by looking at this piece of code? I cannot send the code but I can respond to questions.

Error location
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
NorieAnalyst Assistant

Commented:
What is crdlist(i) when you get the error?
Crdlist is dimensioned as a variant with no dimensions.
And then split using the split command as shown above
The value of i is 2 and n is 235
crdlist
But why should it error out at Next i  ?
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Older than dirt
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
If you were to separate the concatenated line into 3 lines you'll probably find that the ncrdlist(i) = CLng(0 & crdList(i)) is the problem. It's probably because CLng can't be used against something if it contains non-numeric data.
I have been using the same format since long. Only when the size of the data changes to something (which I have not figured out yet) I get this error.
NorieAnalyst Assistant

Commented:
A string like '0-3898' can't be converted to Long.

If the purpose of the code is to convert to Long do you actually need the 0 &?
NorieAnalyst Assistant

Commented:
A string like '0-3898' can't be converted to Long.

If the purpose of the code is to convert to Long do you actually need the 0 &?
Martin LissOlder than dirt
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Rather than posting an image could you post the actual code and tell us the values (and types) of all the variables at the time of the error?
I never looked at anything else while the error was highlighted at Next i

Thanks a lot
Martin LissOlder than dirt
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial