View Single Post
 
Old 05-01-2011, 02:35 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jamal,

If you want that facility, you can embed and Excel worksheet into the document. Alternatively, you can input the values into the table, then run a macro like:
Code:
Sub DecimalFormatter()
Dim Rslt, RsDz, oCel As Cell, Rng As Range
If Selection.Information(wdWithInTable) = False Then
  MsgBox "Cannot run outside a table", vbExclamation, "Decimal Formatter"
  Exit Sub
End If
Rslt = MsgBox("Format the whole table?", vbYesNoCancel, "Decimal Formatter")
If Rslt = vbCancel Then Exit Sub
RsDz = MsgBox("Apply currency formatting?", vbYesNo, "Decimal Formatter")
If RsDz = vbNo Then RsDz = ""
If RsDz = vbYes Then RsDz = "$"
If Rslt = vbNo Then
  For Each oCel In Selection.Cells
    Set Rng = oCel.Range
    With Rng
    .End = .End - 1
      If IsNumeric(.Text) Then .Text = Format(.Text, RsDz & "#,##0.00")
    End With
  Next
End If
If Rslt = vbYes Then
  For Each oCel In Selection.Tables(1).Range.Cells
    Set Rng = oCel.Range
    With Rng
    .End = .End - 1
      If IsNumeric(.Text) Then .Text = Format(.Text, RsDz & "#,##0.00")
    End With
  Next
End If
End Sub
For PC macro installation & usage instructions, see: Installing Macros
For Mac macro installation & usage instructions, see: Word:mac - Install a Macro
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote