0

I am fledgling VBA macro user.

I have a macro that converts a txt file into specific length fields, and it all works fine.

However, one of those fields is always a 10 digit number.
When the macro runs, this number is converted into Excel, where the last few numbers are returned as zeros as Excel doesn't like long numbers (how infuriating).

What is the best way to convert an array as below into text/string before it gets into excel?

Array(53, 1), Array (67, 1), Array(77, 1)
TrailingMinusNumbers:=True 

In Excel, this would be something like =text(Array(67, 1), "general").

I've tried CStr(Array(67, 1)) & String((10),Array(67, 1)) & (Array(67, 1), As String).

1
  • 1
    Welcome to SO. where the last few numbers are returned as zeros as excel doesn't like long numbers What value is it? Excel can work with several decimals, 15. Commented Jul 28, 2020 at 12:21

1 Answer 1

0

Try with:

Format(Array(67, 1), String(10, "0"))

or, if decimals:

Format(Array(67, 1), "0." & String(10, "0"))
Sign up to request clarification or add additional context in comments.

2 Comments

HI Thanks for the suggestion. now I get the below error
Can't tell what it is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.