How do I format numbers, eg with one or two decimal places

R

Ralph Abraham

I am unable to find the control that enables me to change the number of
decimal places for numbers in a document or inserted Excel spreadsheet. Any
help?
 
R

Ralph Abraham

Thank you - I will have to read and educate myself. I suspect the table has
an embedded style template that has to be altered - over the weekend I will
see if I can find out how to do this using your tip.
 
G

Graham Mayor

Apart from using fields, there is no way to set a number format in Word
text - whether in a table or not - with styles. Excel of course has this
option.
You can convert selected numbers to fields with a macro and apply a number
formatting switch eg for 2 decimal places:

Sub NumberToField
Dim sText As String
Dim i As Integer
sText = Selection
i = Len(sText)
With Selection
.Fields.Add Range:=Selection.Range, _
Type:=wdFieldEmpty, _
PreserveFormatting:=False
.TypeText Text:="="
.MoveRight Unit:=wdCharacter, Count:=i
.TypeText Text:=" \# "",0.00"""
.Fields.Update
End With
End Sub

http://www.gmayor.com/installing_macro.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top