Skip to content

Instantly share code, notes, and snippets.

@DuongAQ
Created October 17, 2018 06:55
Show Gist options
  • Save DuongAQ/6222c161f2087eeef7ad7ba24a4a6e88 to your computer and use it in GitHub Desktop.
Save DuongAQ/6222c161f2087eeef7ad7ba24a4a6e88 to your computer and use it in GitHub Desktop.
Sub RoundNum()
'Updateby20140128
Dim Rng As Range
Dim WorkRng As Range
Dim xNum As Integer
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
xNum = Application.InputBox("Decimal", xTitleId, Type:=1)
For Each Rng In WorkRng
Rng.Value = Application.WorksheetFunction.Round(Rng.Value, xNum)
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment