[Solved] Need VBA Code to removing Dot (.) from the amount and it should display number with length of 6 digits [closed]


add this into a seperate module

Function sixdigits(amount) As String

Dim strAmount As String

strAmount = Replace(Left(amount, 6), ".", "") ' use replace and left to create a string of 6 characters
Do Until Len(strAmount) >= 6 ' loop until 6+
    strAmount = "0" & strAmount
Loop: sixdigits = strAmount

End Function

then in your code, where you have the amount from the customer, change the line to:

customerAmount = sixdigits(customerAmount)

one thing to note is that the amount value is given in a string not a value.

solved Need VBA Code to removing Dot (.) from the amount and it should display number with length of 6 digits [closed]