Rounding

  • Thread starter Thread starter Craig
  • Start date Start date
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
 
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
 
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
 
Back
Top