Thursday, December 10, 2009

Convert Decimal to Percentage using VBA Format Function

Here is a simple example to convert a decimal to percentage using VBA function

Sub Con_Decimal2Percentage()


Dim dblSuccess As Double
Dim sSuccess As String

dblSuccess = 0.54

sSuccess = FormatPercent(dblSuccess, 2)

sSuccess = Format(Expression:=dblSuccess, Format:="Percent")


End Sub

No comments: