View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default function or format - remove decimal but retain value

Select the cells you want to change and run this macro:

Sub fixer()
For Each r In Selection
With r
v = "0000" & Replace(.Text, ".", "")
.Clear
.NumberFormat = "@"
.Value = v
End With
Next
End Sub

It removes the decimal point and puts the 4 zeros in front.
--
Gary''s Student - gsnu200776


"Geraldine" wrote:

I need to take a column of numbers 1235.36 and change to 123536 with a number
of leading zeros. End result 0000123536. Is there a format or function to
accomplish this task?

Thanks for any suggestions.