number format

  • Thread starter Thread starter carno
  • Start date Start date
C

carno

How to put the exponent constant in representation of a number in MS
excel? We can move the decimal point.
E.g. i want to represent 101325 as 1.01e5. similarly 1013250 as
10.13e5. E5 should be constant.
 
I tried that, but it does not give correct results. You can also try and
let me know.

Thanks
 
Nice reply from Gary''s Student. It works. But then we have to have
another cell for that. It is not formatting.
 
Can't be done with formatting as E will always display 1 digit.

This ain't foirmatting either, but maybe it's okay

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "A1"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Value = Format(.Value / 100000, "0.00") & "E5"
.NumberFormat = "@"
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Back
Top