A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to make numbers look like currency in Word using a style?



 
 
Thread Tools Display Modes
  #1  
Old November 4th, 2005, 02:20 AM
n_deneane93
external usenet poster
 
Posts: n/a
Default How to make numbers look like currency in Word using a style?

I want to be able to enter numbers in to a column of a table and have it
automatically change to look like a currency value (2500 becomes $2,500.00)
-- like it does in Excel. Is this possible in Word with a style or a macro?
  #2  
Old November 4th, 2005, 03:36 AM
Suzanne S. Barnhill
external usenet poster
 
Posts: n/a
Default How to make numbers look like currency in Word using a style?

There's no way to do this in Word unless (a) you insert an Excel sheet or
(b) the number is a field of some sort. In the latter case, you can use a
numeric picture switch to format it.

--
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.

"n_deneane93" wrote in message
...
I want to be able to enter numbers in to a column of a table and have it
automatically change to look like a currency value (2500 becomes

$2,500.00)
-- like it does in Excel. Is this possible in Word with a style or a

macro?

  #3  
Old November 4th, 2005, 05:49 AM
Doug Robbins - Word MVP
external usenet poster
 
Posts: n/a
Default How to make numbers look like currency in Word using a style?

Starting with the second row, the following macro will convert all numbers
in the second column of the first table in the document.

Dim i As Long, mynum As Range
With ActiveDocument.Tables(1)
For i = 2 To .Rows.Count
Set mynum = .Cell(i, 2).Range
mynum.End = mynum.End - 1
.Cell(i, 2).Range = Format(mynum, "$#,##0.00")
Next i
End With

To have it operate on the first row, change i = 2 to i = 1; for a different
column change Cell(i, 2) to Cell(i, n) where n is the number of the column
and for a different table, change Tables(1) to Tables(#) where # is the
number of the table in the document.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"n_deneane93" wrote in message
...
I want to be able to enter numbers in to a column of a table and have it
automatically change to look like a currency value (2500 becomes
$2,500.00)
-- like it does in Excel. Is this possible in Word with a style or a
macro?



  #4  
Old November 4th, 2005, 01:48 PM
n_deneane93
external usenet poster
 
Posts: n/a
Default How to make numbers look like currency in Word using a style?

Thanks! I think I understand and I might be able to do that. I knew it
would not be as easy as Excel and figured some sort of macro would have to do
the trick. I'll work on it a bit and see what happens! Thanks for the tip.

"Suzanne S. Barnhill" wrote:

There's no way to do this in Word unless (a) you insert an Excel sheet or
(b) the number is a field of some sort. In the latter case, you can use a
numeric picture switch to format it.

--
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.

"n_deneane93" wrote in message
...
I want to be able to enter numbers in to a column of a table and have it
automatically change to look like a currency value (2500 becomes

$2,500.00)
-- like it does in Excel. Is this possible in Word with a style or a

macro?


  #5  
Old November 4th, 2005, 02:18 PM
n_deneane93
external usenet poster
 
Posts: n/a
Default How to make numbers look like currency in Word using a style?

Thanks! I don't get it, but I am sure it works. My knowledge of macros is
nil. I guessed it would take a macro of some sort to make it work, but this
appears to be way out of my league. Thanks for taking the time to post.
You've answered my question.

"Doug Robbins - Word MVP" wrote:

Starting with the second row, the following macro will convert all numbers
in the second column of the first table in the document.

Dim i As Long, mynum As Range
With ActiveDocument.Tables(1)
For i = 2 To .Rows.Count
Set mynum = .Cell(i, 2).Range
mynum.End = mynum.End - 1
.Cell(i, 2).Range = Format(mynum, "$#,##0.00")
Next i
End With

To have it operate on the first row, change i = 2 to i = 1; for a different
column change Cell(i, 2) to Cell(i, n) where n is the number of the column
and for a different table, change Tables(1) to Tables(#) where # is the
number of the table in the document.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"n_deneane93" wrote in message
...
I want to be able to enter numbers in to a column of a table and have it
automatically change to look like a currency value (2500 becomes
$2,500.00)
-- like it does in Excel. Is this possible in Word with a style or a
macro?




  #6  
Old November 4th, 2005, 05:50 PM
Greg
external usenet poster
 
Posts: n/a
Default How to make numbers look like currency in Word using a style?

Is this possible in Word with a style or a macro?

Actually it is possible with a macro:

Sub ConvertToCurrencyAndAdvance()
Dim i As Long
Dim j As Long
Dim oNum As Range
If Not Selection.Information(wdWithInTable) Then Exit Sub
i = Selection.Information(wdStartOfRangeRowNumber)
j = Selection.Information(wdStartOfRangeColumnNumber)
With Selection.Tables(1)
Set oNum = .Cell(i, j).Range
oNum.End = oNum.End - 1
If IsNumeric(oNum) Then
.Cell(i, j).Range = Format(oNum, "$#,##0.00")
If i .Rows.Count Then
.Cell(i + 1, j).Select
ElseIf j .Columns.Count Then
.Cell(2, j + 1).Select
Else
.Cell(2, 1).Select
End If
Selection.Collapse Direction:=wdCollapseStart
Else
Beep
oNum.Select
End If
End With
End Sub

You will need to assign to an easy keyboard shortcut. Maybe ALT+Enter
or something similar. The macro will current valid numeric entries in
the cell and move down 1 cell. When it reaches the end of the cell it
will advance to the second row of the next column (or first column if
already in last column). You could easily adapt the code to advance
across vice down or to start in the first vice second row.

HTH

  #7  
Old November 5th, 2005, 03:01 AM
Greg Maxey
external usenet poster
 
Posts: n/a
Default How to make numbers look like currency in Word using a style?

I posted a web page on this method this evening.

http://gregmaxey.mvps.org/Currency_Format.htm

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

Doug Robbins - Word MVP wrote:
Starting with the second row, the following macro will convert all
numbers in the second column of the first table in the document.

Dim i As Long, mynum As Range
With ActiveDocument.Tables(1)
For i = 2 To .Rows.Count
Set mynum = .Cell(i, 2).Range
mynum.End = mynum.End - 1
.Cell(i, 2).Range = Format(mynum, "$#,##0.00")
Next i
End With

To have it operate on the first row, change i = 2 to i = 1; for a
different column change Cell(i, 2) to Cell(i, n) where n is the
number of the column and for a different table, change Tables(1) to
Tables(#) where # is the number of the table in the document.


"n_deneane93" wrote in message
...
I want to be able to enter numbers in to a column of a table and
have it automatically change to look like a currency value (2500
becomes $2,500.00)
-- like it does in Excel. Is this possible in Word with a style or a
macro?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The WordPerfect "Reveal Codes" method is so much easier to use. Torden General Discussion 6 April 19th, 2010 07:50 PM
Word 97 in Windows XP to maintain formatting Charlie''s Word VBA questions General Discussion 21 October 24th, 2005 09:49 PM
chapter & page number @ bottom of page Grace Page Layout 9 October 12th, 2005 06:38 AM
How to change merge forms from Word Perfect to Microsoft Word Charles Kenyon General Discussion 1 December 30th, 2004 03:35 PM
modify heading 2 style in Word xp sam New Users 6 June 9th, 2004 12:03 AM


All times are GMT +1. The time now is 06:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.