Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.formatting.longdocs
shbutt shbutt is offline
external usenet poster
 
Posts: 2
Default Thousand seperator for number

I work with huge numbers in tables a lot and need to use thousand seperator
formatting on these numbers. What should I do to automatically apply desired
formatting on selected numbers. Is there any default setting in word for this
or any vba macro?

I am using Word 2007 on Win XP.

Regards,

Shahbaz
  #2   Report Post  
Posted to microsoft.public.word.formatting.longdocs
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Thousand seperator for number

Hi shbutt,

There's no auto-formatting for numbers in Word, but the following macro will format any selected table cells containing only
unformatted numbers:

Sub NumberFormat()
Dim oCel As Cell, RngCel As Range
With Selection
If .Information(wdWithInTable) = True Then
For Each oCel In .Cells
Set RngCel = oCel.Range
RngCel.MoveEnd Unit:=wdCharacter, Count:=-1
If IsNumeric(RngCel.Text) Then
If InStr(RngCel.Text, ",") = 0 Then
If InStr(RngCel.Text, ".") = 0 Then
RngCel.Text = Format(RngCel.Text, "#,##0")
Else
RngCel.Text = Format(RngCel.Text, "#,##0.00")
End If
End If
End If
Next
Set RngCel = Nothing
End If
End With
End Sub

As coded, numbers:
.. without decimal places will be given thousands separators; and
.. with decimal places will be given thousands separators and rounded to 2 decimal places.

--
Cheers
macropod
[Microsoft MVP - Word]


"shbutt" wrote in message ...
I work with huge numbers in tables a lot and need to use thousand seperator
formatting on these numbers. What should I do to automatically apply desired
formatting on selected numbers. Is there any default setting in word for this
or any vba macro?

I am using Word 2007 on Win XP.

Regards,

Shahbaz


  #3   Report Post  
Posted to microsoft.public.word.formatting.longdocs
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Thousand seperator for number

Hi shbutt,

There's no auto-formatting for numbers in Word, but the following macro will format any selected table cells containing only
unformatted numbers:

Sub NumberFormat()
Dim oCel As Cell, RngCel As Range
With Selection
If .Information(wdWithInTable) = True Then
For Each oCel In .Cells
Set RngCel = oCel.Range
RngCel.MoveEnd Unit:=wdCharacter, Count:=-1
If IsNumeric(RngCel.Text) Then
If InStr(RngCel.Text, ",") = 0 Then
If InStr(RngCel.Text, ".") = 0 Then
RngCel.Text = Format(RngCel.Text, "#,##0")
Else
RngCel.Text = Format(RngCel.Text, "#,##0.00")
End If
End If
End If
Next
Set RngCel = Nothing
End If
End With
End Sub

As coded, numbers:
.. without decimal places will be given thousands separators; and
.. with decimal places will be given thousands separators and rounded to 2 decimal places.

--
Cheers
macropod
[Microsoft MVP - Word]


"shbutt" wrote in message ...
I work with huge numbers in tables a lot and need to use thousand seperator
formatting on these numbers. What should I do to automatically apply desired
formatting on selected numbers. Is there any default setting in word for this
or any vba macro?

I am using Word 2007 on Win XP.

Regards,

Shahbaz


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
number format in word to show the comma as a seperator Debi Microsoft Word Help 1 April 3rd 09 04:09 PM
adding thousand separators in ms word csr1176 New Users 0 September 9th 08 03:51 PM
Easier way to change decimal and thousand separators ElCagle Microsoft Word Help 3 March 17th 08 11:03 PM
How do I autoformat thousand seperator in Word tables? Mona_LisaJo Tables 0 January 3rd 06 06:54 PM
Want to use 100 seperator instead of 1000 seperator Ilango Microsoft Word Help 1 May 21st 05 01:40 PM


All times are GMT +1. The time now is 01:06 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright 2004-2023 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"