Round Function for Entire Sheet

M

mstjohn

I have a sheet with approx 50 formulas that links to other workbooks and
worksheets. Does anyone know how to round the entire sheet without adding the
round function to every cell?
 
G

Gord Dibben

You could use this macro to add the ROUND function to formulas in place.

Sub RoundAdd()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then
If Not cel.Formula Like "=ROUND(*" Then
myStr = Right(cel.Formula, Len(cel.Formula) - 1)
cel.Value = "=ROUND(" & myStr & ",2)"
End If
End If
Next
End Sub


Gord Dibben MS Excel MVP
 

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

Top