leb,
Certainly not simple, but you could use a worksheet event to achieve that.
Copy the code below, right click on the sheet tab, select "View Code" and
paste in the window that appears. Format column A as text, then enter your
numbers with as many zeroes as you want. The event will convert the string
enetered to a number with the same number of trailing zeroes, and if you
enter a formula, it will format the formula for 3 decimal places.
HTH,
Bernie
MS Excel MVP
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myVal As String
Dim myFormat As String
If Target.Cells.Count > 1 Then Exit Sub
If Target.Column = 1 Then
myVal = Target.Text
If myVal = "" Then Exit Sub
Application.EnableEvents = False
If Left(myVal, 1) <> "=" Then
If InStr(1, Target.Text, ".") <> 0 Then
myFormat = "0." & Application.Rept("0", Len(Target.Text) _
- InStr(1, Target.Text, "."))
Else
myFormat = "0"
End If
Target.NumberFormat = myFormat
Target.Value = Val(myVal)
Else
Target.NumberFormat = "0.000"
Target.Formula = myVal
End If
Application.EnableEvents = True
End If
End Sub
leb said:
How can I force zeros to display following a decimal point in Excel 2002?
Whenever I type a number, such as 3.200, Excel drops the zeros and only
enters 3.2 into the cell. Is there a setting that can be changed to fix
this? (Using the "0.00" custom format seems to help, but if I have another
number, such as 4.70, which only needs one zero to display, then I need
another custom format for that one, and the next one, etc.) If anyone has a
simpler suggestion, I'd appreciate it. Thanks!