|
-
January 12th, 2000, 04:29 AM
#1
rounding numbers
I want to round a number with no decimals, so I use:
Round(MyNumber, 0)
I want to ask you how can I add a digit grouping "." ?
eg. if MyNumber = 1344,78 I want to be displayed as: "1.344,78"
How can I achieve this?
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
-
January 12th, 2000, 04:33 AM
#2
And one more:
... These numbers are displayed in a ListView column and when I try to sort them, it sorts them as text and not numbers, like this way:
105
11
1131
123
But the right order should be:
11
105
123
1131
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
-
January 12th, 2000, 04:42 AM
#3
Re: rounding numbers
ONE possible solution:
Dim number As Double
number = 1344.78
MsgBox Format(number, "#,###.##")
-
January 12th, 2000, 04:50 AM
#4
Re: And one more:
Listview sorts columns as Text.
One possible solution:
- add your values into two separate columns
- make one column invisible (width = 0)
- add a formatted value to the invisible column (l.subitems(1)= format(...)) [format that column in a way that causes correct sort order when sorted as Test]
- sort the listview on that invisible column
-
January 12th, 2000, 04:58 AM
#5
Well,
about my first question:
it worked with this:
Format(Round(MyNumber, 0), "#,###")
Thanx!
about the second question now:
your solution is very clever, I'll try it out and let you know. But I would love an easier way of doing that. Anyway, thak you
P.S. Lothar, check your private messages please!
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
-
January 12th, 2000, 04:59 AM
#6
use Format for rounding number
you can also use the format function for rounding!
Try these:
Dim number as Double
number = 1344.774
MsgBox Format(number, "#,###.##")
number = 1344.776
MsgBox Format(number, "#,###.##")
...will yield 1344.77 and 1344.78
-
January 12th, 2000, 06:33 AM
#7
Re: And one more:
It worked!!!!! Can I rate you again? ;-)
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
-
January 12th, 2000, 07:13 AM
#8
Re: And one more:
>...Can I rate you again? ;-)
go ahead. If it doesn't work, send money! ;-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|