Reputation: 3
I want to add a product number to a collection like this:
colData.Add marke.Value + " " + pn.Value (Range-Objekte)
Every time I start the macro it runs in Runtime Error 13.
If the product number is like 256-78979-0980 everything runs fine.
If the product number is like 8898686 the error occurs.
Writing CStr(pn.Value)
doesn't solve the issue.
The only solution I found is to change the format of all PNs to type text.
Then I need to go in the cell and press "Enter" after that a sign appears on the cell stating that the number is recognized as text.
After that the macro works fine for this cell but not for the others.
How can I change my data to make it work with my macro?
Upvotes: 0
Views: 40
Reputation: 42236
Avoid using +
for concatenation.
Try repalcing of
colData.Add marke.Value + " " + pn.Value
with
colData.Add marke.Value & " " & pn.Value
Upvotes: 1