Rounding

C

Craig

Is there a function key or Macro that will take an
existing worksheet and round the numbers to the nearest
whole number. I know I can enter a Round(xxx,0) into each
cell, but is there a way to do this without having to go
into each cell.

Thanks for any help
 
B

Bill Kuunders

highlight the area, or the whole sheet by clicking in the lefthand top
square and format the cells to number with 0 decimals.
Regards
Bill K
 
G

Gord Dibben

Craig

Select all the cells then run this macro to add the ROUND Function to them.

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 & "," & "0" & ")"
End If
End If
Next
End Sub

Gord Dibben 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