![]() |
|
#1
|
|||
|
|||
|
Hi,
If we have table of figures in word lets say - 100 items with the unit price. If we want to round off the number on maths principle i.e. if more than .5 it increase the number round off for example 12.6 will 13. and if less than .5 it will assume its lower value i.e. 12.4 to 12. I want this on selected table only. Is there a way we can do this. Regards Umesh Banga |
|
#2
|
||||
|
||||
|
All cells, cells in a particular column/row?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
all cells in the selected table.
|
|
#4
|
||||
|
||||
|
In that case, you could use code like:
Code:
Sub FormatNumbers()
Dim Rng As Range, Tbl As Table, oCll As Cell, StrFmt As String
With Selection
If .Information(wdWithInTable) = True Then
For Each oCll In .Tables(1).Range.Cells
Set Rng = oCll.Range
Rng.End = Rng.End - 1
If IsNumeric(Rng.Text) Then
If Left(Rng.Text, 1) Like "[$€ге]" Then
StrFmt = Left(Rng.Text, 1)
Else
StrFmt = ""
End If
If InStr(Rng.Text, ",") > 0 Then
Rng.Text = StrFmt & Format(Round(Rng.Text, 0), "#,###")
Else
Rng.Text = StrFmt & Round(Rng.Text, 0)
End If
End If
Next
End If
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#5
|
|||
|
|||
|
Thanks Paul.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Round Blue Circle Keeps Flashing and Circling
|
randyflycaster | Word | 5 | 09-14-2011 07:29 AM |
Mailing: how to make the "page number" in Word is the same as "row number" in excel w
|
Jamal NUMAN | Word | 1 | 09-03-2011 11:37 AM |
histograms have me running round like headless chook
|
agorgainc | Excel | 2 | 05-12-2011 04:29 AM |
| how can i make round border edges | bobafet | Word | 4 | 11-19-2009 04:40 PM |
| round border egde problem(is there a better option) | bobafet | Word | 0 | 11-17-2009 11:36 AM |