How do I preserve the trailing zeros after the decimal point?

Chir1998

New Member
Joined
Nov 19, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
How do I remove the decimal such that the trailing zero after the decimal point remains? For example when I use Ctrl+H and replace "." With a blank, 0.971160 becomes 97116 but I need it to become 971160. How do I do this? I have a large list of numbers with trailing zeros with some that don't. So I can't really just select a range and multiply it to get the answer.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try this on a copy of your Workbook as unexpected results may occur. Select the cells that you want to modify and run this Sub:
VBA Code:
Sub RemoveDecimal()
Dim cell As Range
For Each cell In Selection
    cell.Value = Right(cell.Value, Len(cell.Value) - InStr(1, cell.Value, "."))
Next cell
End Sub
 
Upvote 0
This should work for any number of trailing zeros.
VBA Code:
Sub RemoveDecimal()
Dim cell As Range
For Each cell In Selection
    If InStr(1, cell.Value, "0.") > 0 Then
        cell.Value = Replace(cell.Text, "0.", "")
        cell.NumberFormat = "0"
    End If
Next cell
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top