How to format cells in a table for currency



Jim
07-10-2005, 12:03 AM
I have created a table in Word 2000. 90% of the entries will be text that I
need to manipulate, so I don't want to use an Excel table becuase it limits
my text formatting.

However, one column of the table will be all currency entries. How can I
format the cells for currency? I.E. if I enter 358760, it displays as
$3,587.60.

Thanks for any help
--
Jim

Greg Maxey
07-10-2005, 12:03 AM
Jim,

You could do this using a protected form where the fields in the one column
where format with a currency format switch. Another opition is to run a
macro to format the desired (say selected) cells before printing or
distributing a smooth document. Something like this may work for you:

Sub ConvertSelectedRawNumbersInTableToCurrencyFormat()

If Not Selection.Information(wdWithInTable) Then
MsgBox "Place cursor in a table cell or select multiple cells."
Exit Sub
End If

Dim oCl As Word.Cell
Dim oRng As Range
Dim Count As Integer
For Each oCl In Selection.Cells
Set oRng = oCl.Range
oRng.End = oRng.End - 1
With oRng
If IsNumeric(oRng) Then
.Text = FormatCurrency _
(Expression:=.Text, _
NumDigitsAfterDecimal:=2, _
IncludeLeadingDigit:=vbTrue, _
UseParensForNegativeNumbers:=vbTrue)
End If
If IsNumeric(oRng) = False Then
Count = Count + 1
End If
End With
Next oCl
If Count = 0 Then
MsgBox "Conversion complete."
End If
Selection.Collapse wdCollapseEnd
If Count = 1 Then
MsgBox "The selected cell is empty or content is not numerical.", ,
"Notice!!"
End If
If Count > 1 Then
MsgBox "" & Count & " of the selected cells are empty or content is not
numerical. Conversion complete on all selected numerical cells.", ,
"Notice!!"
End If
End Sub

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Jim wrote:
> I have created a table in Word 2000. 90% of the entries will be text
> that I need to manipulate, so I don't want to use an Excel table
> becuase it limits my text formatting.
>
> However, one column of the table will be all currency entries. How
> can I format the cells for currency? I.E. if I enter 358760, it
> displays as $3,587.60.
>
> Thanks for any help

Suzanne S. Barnhill
07-10-2005, 12:03 AM
This can't be done without a field.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Jim" <Jim@discussions.microsoft.com> wrote in message
news:08A01CBD-F1FF-465E-8062-F40770E9DA4D@microsoft.com...
> I have created a table in Word 2000. 90% of the entries will be text that
I
> need to manipulate, so I don't want to use an Excel table becuase it
limits
> my text formatting.
>
> However, one column of the table will be all currency entries. How can I
> format the cells for currency? I.E. if I enter 358760, it displays as
> $3,587.60.
>
> Thanks for any help
> --
> Jim


How to format cells in a table for currency