View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jon jon is offline
external usenet poster
 
Posts: 13
Default Help with Code from John Mansfield

Hi,
In an earlier post John provided me with a macro to round the values in a
selected cell range.
The code was:
Sub Add_Rounding()

Dim cellRange As Range
Dim Rng As Range
Dim cellFormula As String

On Error Resume Next

Set cellRange = Range("A1:C10").SpecialCells(xlCellTypeFormulas)

For Each Rng In cellRange

cellFormula = Mid(Rng.Formula, 2, 1024)
If InStr(UCase(cellFormula), UCase("Round")) = 0 Then
Rng.Formula = "=round(" & cellFormula & ",0)"
End If

Next Rng

End Sub

Unfortunately, some of my worksheets have fixed values not calculated values
in the fields, and the macro doesn't amend any cell that doesn't begin with
an = sign.

Can anyone tell me how to make it work for fixed values.

Thanks

Jon