![]() |
How to write this correctly?
Hi everone,
I have this line of VBA code: ARngSolution(Cline, Aline).Value = Val(Left(ARngSolution(Cline, Aline).Value, 7)) One of the values that it writes down comes like this: 3.84894 while when I checked it using MsgBox, it came as this: 3.84894E-02 What should I do to let the code write it correctly as: .0384894? Regards, Mike |
How to write this correctly?
? 3.84894E-02
0.0384894 What are you trying to accomplish with the code that you show? -- Regards, Tom Ogilvy "Michael" wrote in message om... Hi everone, I have this line of VBA code: ARngSolution(Cline, Aline).Value = Val(Left(ARngSolution(Cline, Aline).Value, 7)) One of the values that it writes down comes like this: 3.84894 while when I checked it using MsgBox, it came as this: 3.84894E-02 What should I do to let the code write it correctly as: .0384894? Regards, Mike |
How to write this correctly?
I am running an optimization model. Upon finding a solution, the VBA
code will write down the solution values into an excel sheet. Some of the values come from the optimization model, upon finding a solution, like 3.84894E-02 for example. However, it writes down in excel sheet as 3.8489 So, the line I am using: ARngSolution(Cline, Aline).Value = Val(Left(ARngSolution(Cline,Aline).Value, 7)) needs some fixing I think so the number can be written as .08489 for example. Regards, Mike "Tom Ogilvy" wrote in message ... ? 3.84894E-02 0.0384894 What are you trying to accomplish with the code that you show? -- Regards, Tom Ogilvy "Michael" wrote in message om... Hi everone, I have this line of VBA code: ARngSolution(Cline, Aline).Value = Val(Left(ARngSolution(Cline, Aline).Value, 7)) One of the values that it writes down comes like this: 3.84894 while when I checked it using MsgBox, it came as this: 3.84894E-02 What should I do to let the code write it correctly as: .0384894? Regards, Mike |
How to write this correctly?
if you place 3.84894E-02 in a cell and then format it with
format=Cells=Number tab and select 7 decimals, it should appear as you want it. -- Regards, Tom Ogilvy "Michael" wrote in message m... I am running an optimization model. Upon finding a solution, the VBA code will write down the solution values into an excel sheet. Some of the values come from the optimization model, upon finding a solution, like 3.84894E-02 for example. However, it writes down in excel sheet as 3.8489 So, the line I am using: ARngSolution(Cline, Aline).Value = Val(Left(ARngSolution(Cline,Aline).Value, 7)) needs some fixing I think so the number can be written as .08489 for example. Regards, Mike "Tom Ogilvy" wrote in message ... ? 3.84894E-02 0.0384894 What are you trying to accomplish with the code that you show? -- Regards, Tom Ogilvy "Michael" wrote in message om... Hi everone, I have this line of VBA code: ARngSolution(Cline, Aline).Value = Val(Left(ARngSolution(Cline, Aline).Value, 7)) One of the values that it writes down comes like this: 3.84894 while when I checked it using MsgBox, it came as this: 3.84894E-02 What should I do to let the code write it correctly as: .0384894? Regards, Mike |
How to write this correctly?
Tom,
What you are saying is true. However, it is not exactly what I have! May be I did put it right. Let me re-word it please. When I put the following VBA line: MsgBox ARngSolution(Cline, Aline).Value I see that value, say: 3.84894E-02 When I look in the excel sheet where the value is written, I see it 3.84894 It is like the "E-02" is completely missed!? What am I doing wrong? Should I change this VBA line: ARngSolution(Cline, Aline).Value = Val(Left(ARngSolution(Cline, Aline).Value, 5)) Thanks, Mike "Tom Ogilvy" wrote in message ... if you place 3.84894E-02 in a cell and then format it with format=Cells=Number tab and select 7 decimals, it should appear as you want it. -- Regards, Tom Ogilvy "Michael" wrote in message m... I am running an optimization model. Upon finding a solution, the VBA code will write down the solution values into an excel sheet. Some of the values come from the optimization model, upon finding a solution, like 3.84894E-02 for example. However, it writes down in excel sheet as 3.8489 So, the line I am using: ARngSolution(Cline, Aline).Value = Val(Left(ARngSolution(Cline,Aline).Value, 7)) needs some fixing I think so the number can be written as .08489 for example. Regards, Mike "Tom Ogilvy" wrote in message ... ? 3.84894E-02 0.0384894 What are you trying to accomplish with the code that you show? -- Regards, Tom Ogilvy "Michael" wrote in message om... Hi everone, I have this line of VBA code: ARngSolution(Cline, Aline).Value = Val(Left(ARngSolution(Cline, Aline).Value, 7)) One of the values that it writes down comes like this: 3.84894 while when I checked it using MsgBox, it came as this: 3.84894E-02 What should I do to let the code write it correctly as: .0384894? Regards, Mike |
All times are GMT +1. The time now is 10:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com