Rounding a number to the nearest 5 or 10 or X

前端 未结 13 1650
臣服心动
臣服心动 2020-11-28 08:11

Given numbers like 499, 73433, 2348 what VBA can I use to round to the nearest 5 or 10? or an arbitrary number?

By 5:

 499 ->  500
2348 -> 2350         


        
相关标签:
13条回答
  • 2020-11-28 08:42

    To mimic in Visual Basic the way the round function works in Excel, you just have to use: WorksheetFunction.Round(number, decimals)

    This way the banking or accounting rounding don't do the rounding.

    0 讨论(0)
提交回复
热议问题