Round a form field within a table

  • Thread starter Thread starter Loretta
  • Start date Start date
L

Loretta

I want to round the input in a form field. In my table, cell B2 is a form
field and when I enter 2.75, I want it to round to 3. Is there a way to do
that without using a calculating field?
 
Assuming the formfield in the cell is a text form field named "Text1", the
following macro run on exit from that field will round the result
Change "Text1" to reflect the true name of the field.

Dim sText As String
With ActiveDocument.FormFields("Text1")
If IsNumeric(.Result) = True Then
sText = Round(.Result, 0)
.Result = sText
End If
End With

http://www.gmayor.com/installing_macro.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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

Back
Top