NUMBERS IN A TABLE

K

Kathy

I created a table and need to find a quick way to have the dollar amounts
insert a comma automatically. It's getting very tedious inserting that comma
!!
 
M

macropod

Hi Kathy,

Word won't auto-format the numbers for you, but you can input the unformatted numbers (ie you don't even need to add the '$') then
select them and run a macro like:
Sub MakeCurrency()
Dim oCel As Cell
Dim oRng As Range
If Selection.Information(wdWithInTable) Then
For Each oCel In Selection.Cells
Set oRng = oCel.Range
oRng.MoveEnd Unit:=wdCharacter, Count:=-1
On Error Resume Next
If CDec(oRng.Text) Then oCel.Range.Text = Format(oRng.Text, "$#,##0.00")
Next
End If
End Sub
 

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