View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
macropod macropod is offline
external usenet poster
 
Posts: 329
Default applying rounding formula to entire worksheet

Hi mateo,

It doesn't behave that way for me. On my system, it processes all cells containing only numeric values, or formulae that return
numeric values, and skips any other cells (eg empty cells and cells with text). Merged cells have no effect - the code processes
them just the same as it does with un-merged cells.

Did you modify the code in any way?

Cheers

--
macropod
[MVP - Microsoft Word]


"mateo" wrote in message ...
| Thanks for that Macropod, I should have mention the text titles. For some
| reason when running your new macro after selecting everything it either says
| "this macro requires merge cells to be of the same size." Or when just
| selecting numbers, it make each row contain the same number as the first cell
| in each row.
|
|
| "macropod" wrote:
|
| Hi mateo,
|
| Had you mentioned there being an issue with text & values being interspersed, I might have suggested using:
|
| Sub RoundDownRange()
| Dim OldVal As Object
| Dim NewVal As String
| For Each OldVal In Selection
| If Application.WorksheetFunction.IsNumber(OldVal.Valu e) Then
| NewVal = OldVal.Formula
| If Left(NewVal, 1) = "=" Then
| NewVal = Right(NewVal, Len(NewVal) - 1)
| End If
| NewVal = "=ROUND(" & NewVal & ",-1)-1"
| OldVal.Formula = NewVal
| End If
| Next OldVal
| End Sub
|
| Although the code does what you asked for, the results are a bit odd (ie -1) if the starting value is less than 5.
|
| Cheers
|
| --
| macropod
| [MVP - Microsoft Word]
|
|
|