ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   number of decimals (https://www.excelbanter.com/excel-programming/373445-number-decimals.html)

Arne Hegefors

number of decimals
 
Hi! I have a userform attached to a macro. when the macro runs the user can
see how much of the process has been made. I show this in percentage form.
However I do not know how to adjust the number of decimals so now it looks
like this: Completion: 11,23652357754356%. Needless to say it does not look
good. Can anyone help me with this please?

Here I calculate the percentage:
.Caption2 = "Process completion: " & CStr((pos / lngListLength)) * 100 & "
% "

and in a class module i set properties:
Property Let Caption2(strCaption As String)
frmProgress.lblMsg2.Caption = strCaption
DoEvents
End Property

please help me! any help appreciated! thanks alot

Tom Ogilvy

number of decimals
 
demo'd from the immediate window:

pos = 20
ListLength = 194
? pos/Listlength
0.103092783505155
? format(pos / ListLength,"0.0%")
10.3%


--
Regards,
Tom Ogilvy


"Arne Hegefors" wrote:

Hi! I have a userform attached to a macro. when the macro runs the user can
see how much of the process has been made. I show this in percentage form.
However I do not know how to adjust the number of decimals so now it looks
like this: Completion: 11,23652357754356%. Needless to say it does not look
good. Can anyone help me with this please?

Here I calculate the percentage:
.Caption2 = "Process completion: " & CStr((pos / lngListLength)) * 100 & "
% "

and in a class module i set properties:
Property Let Caption2(strCaption As String)
frmProgress.lblMsg2.Caption = strCaption
DoEvents
End Property

please help me! any help appreciated! thanks alot



All times are GMT +1. The time now is 02:18 AM.

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