The title says it all. Consider the following example:
Option Explicit
Sub RoundToDecimalsDefinedByEndUser()
Dim DecimNum As Integer
DecimNum = InputBox("How many decimals do you want?", "Enter")
Cells(1, 1).Value = Application.WorksheetFunction.Round(Cells(1, 1).Value, DecimNum)
End Sub
Consider a situation where the end user wants to have 2 decimals, and the number to be rounded is 0.10111. The result should be 0.10, but Excel forces the result to be 0.1. Any suggestions on how to keep the trailing zero(s)?