I am editing a legacy Visual Basic 6.0 program. It reads from a GPIB instrument and obtains a raw string in scientific notation. For example:
2.231321654E+01
Another line in the program processes that string so that it would be suitable for input into the spreadsheet:
Round(2.231321654E+01, 1)
returns 22.3
I want to have 2 decimal places:
Round(2.231321654E+01, 2)
should return 22.31
, but NO, it returns 22.3
. Why?
Another approach:
I tried to bypass the Round()
processing and have the program input the raw string directly into the spreadsheet. I still get 22.3
Yet another approach:
I bypassed the program entirely and manually input 2.231321654E+01
into any cell in the spreadsheet. I still get 22.3
Summary:
I want to write 2 decimal places into the spreadsheet. How do I do it? I think the original author manipulated the cell number properties to retain only up to one decimal place. How do I manipulate it? What should I look for in the code?
It's probably something like
MyCell.NumberFormat = "#.00"