Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Add @ROUND to several cells

109 views
Skip to first unread message

Jason L.

unread,
Oct 29, 2002, 4:35:13 PM10/29/02
to
Is there a way to add the @ROUND function to a selection
of cells that contain formulas?

J.E. McGimpsey

unread,
Oct 29, 2002, 5:50:36 PM10/29/02
to
one way:

Public Sub WrapaRounds()
Dim cell As Range
On Error Resume Next
With Selection
For Each cell In Union(.SpecialCells(xlCellTypeConstants, _
xlNumbers), .SpecialCells(xlCellTypeFormulas))
With cell
.Formula = "=ROUND(" & Mid(.Formula, 1 - _
.HasFormula) & ", 2)"
End With
Next cell
End With
End Sub

This adds to both formulas and numeric constants. If you just want
formulae to be wrapped, use:

For Each cell In .SpecialCells(xlCellTypeFormulas)
With cell
.Formula = "=ROUND(" & Mid(.Formula, 2) & ", 2)"
End With
Next cell

In article <106701c27f93$10c43790$3aef2ecf@TKMSFTNGXA09>, Jason L.

Jason L.

unread,
Oct 30, 2002, 10:47:56 AM10/30/02
to
Thanks J.E.! This worked great.
>.
>
0 new messages