Saturday, April 20, 2019

Remove the Apostrophe from a Number/Remove Decimals from Numbers


Remove the Apostrophe from a Number
If you have numeric data where you have an apostrophe before each number, you run this code to remove it.
Sub removeApostrophes()
Selection.Value = Selection.Value
End Sub
Remove Decimals from Numbers
This code will simply help you to remove all the decimals from the numbers from the selected range.
Sub removeDecimals()
Dim lnumber As Double
Dim lResult As Long
Dim rng As Range
For Each rng In Selection
rng.Value= Int(rng)
rng.NumberFormat= "0"
Next rng
End Sub

No comments:

Post a Comment