Format and round decimals

ignasis

New member
Joined
Apr 1, 2016
Messages
28
Reaction score
0
Points
0
Hello again!

This time is about formatting number to percent and round it to 2 decimals.

I've tried the following:
ExcelVBACode
0,001366789891,36678989.cells(10,6)
0,001366789890,0014Round(.Cells(10,6), 4)
0,001366789891,36678989E-03Format(.Cells(10,6), Percent)
0,001366789890,0014Round(Format(.Cells(10,6), Percent), 4)

What I need is to see in VBA --> 1,36%

I've also tried changing Excel values to % format, but VBA seems not to take that %values either.

Any suggestion would be greatly appreaciated,

Thanks!
 
Perhaps using the FLOOR function? Application.WorksheetFunction.Floor(...)

(that's all I know, not being a VBA man) :redface:
 
thanks for you reply Pecoflyer,

If I am not wrong, I think floor doesn't work with negative numbers.

And I think round(3.7) =4 and floor(3.7)=3 so I would be in the same situation
 
well, I am really sorry but I found the SILLY issue... just need to put "Percent" instead of Percent.

So the correct answer is format(.cells(10,6), "Percent") and it returns 0,13% (not 1,36%, I typed wrong in the first post)
 
Explore (VBEditor / helpfiles)

Code:
Sub M_snb()
   MsgBox FormatPercent(0.2375)
End Sub
 
Back
Top