ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   In VBA editor x = 1.1e-3 is reformated to x = 0.0011 (https://www.excelbanter.com/excel-programming/399310-vba-editor-x-%3D-1-1e-3-reformated-x-%3D-0-0011-a.html)

elfnor

In VBA editor x = 1.1e-3 is reformated to x = 0.0011
 
When I enter the line

x = 1.1e-3

in the visual basic editor and hit return, it is automatically
reformated to

x = 0.0011

Can I stop this? It makes it hard to check that constants such as
1.1e-11 are programed correctly.


Mike

In VBA editor x = 1.1e-3 is reformated to x = 0.0011
 
maybe this
x = "1.1e-3"

"elfnor" wrote:

When I enter the line

x = 1.1e-3

in the visual basic editor and hit return, it is automatically
reformated to

x = 0.0011

Can I stop this? It makes it hard to check that constants such as
1.1e-11 are programed correctly.



Jim Cone

In VBA editor x = 1.1e-3 is reformated to x = 0.0011
 

You can declare Constants equal to the number and then use the
constants in your code...
Const OnePtOneE_3 As Double = 0.0011
Const OnePtOneE_11 As Double = 0.000000000011

x = OnePtOneE_11 * 2
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"elfnor"wrote in message
When I enter the line
x = 1.1e-3
in the visual basic editor and hit return, it is automatically
reformated to
x = 0.0011
Can I stop this? It makes it hard to check that constants such as
1.1e-11 are programed correctly.


Bill Renaud

In VBA editor x = 1.1e-3 is reformated to x = 0.0011
 
Maybe something like:

X = 1.1 * 10 ^ -3

or

X = 1.1 * 10 ^(-3) to make sure the -3 is not read as a subtract
operation.

--
Regards,
Bill Renaud





All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com