View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevin B Kevin B is offline
external usenet poster
 
Posts: 1,316
Default Change a # w/decimal places to no decimals, 13 char's, w/leading 0

Are the resulting values numeric or character. If numeric you can create a
custom format that pads cells with 0's. The format would be "00000000000000"
so that any position not having a corresponding number will display a 0
instead.

If it's a string the following function might be of some assistance:

Function ConvertVals(Value As Double) As String

Dim strVal As String
Dim i As Integer
Application.Volatile

If Value < 0 Then Value = Value * -1

strVal = CStr(Value)
strVal = Replace(strVal, ".", "")
i = Len(strVal)

Do Until i = 13
strVal = "0" & strVal
i = Len(strVal)
Loop

ConvertVals = strVal

End Function

--
Kevin Backmann


"Mary" wrote:

To import data into SAP from Excel, I need to create a load file that
converts a column w/positive or negative values & decimal places into all
positive values with no decimal places, and with leading zeroes--to fill out
13 places. For example:

-74737.76069 needs to be converted to
0000747376069
and
105286.99 needs to be converted to
0000010528699