ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Excel decimal formating problems (https://www.excelbanter.com/excel-programming/409933-vba-excel-decimal-formating-problems.html)

[email protected]

VBA Excel decimal formating problems
 
Hello,
I have a small problem in my excel VBA application.
In above expresion:

Dim A as Double
A = A + 1

I want to see A in A.0 format
Everything is ok then A is 0.1 or 0.2 .... 0.9
But when I have total value ".0" is missing

I was tring to make a format like:
A = Format (A, ""###0.0")

or
A = Round (A, 1)

but it is not working.

This value 1.0 I want to write in Excel Cell, but there is only 1.
Thanks in advance
Maro

Dave Peterson

VBA Excel decimal formating problems
 
You'll want to change the numberformat of the cell:

With worksheets("sheet1").range("a1")
.numberformat = "###0.0"
.value = A
End with



wrote:

Hello,
I have a small problem in my excel VBA application.
In above expresion:

Dim A as Double
A = A + 1

I want to see A in A.0 format
Everything is ok then A is 0.1 or 0.2 .... 0.9
But when I have total value ".0" is missing

I was tring to make a format like:
A = Format (A, ""###0.0")

or
A = Round (A, 1)

but it is not working.

This value 1.0 I want to write in Excel Cell, but there is only 1.
Thanks in advance
Maro


--

Dave Peterson


All times are GMT +1. The time now is 11:40 AM.

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