adding a forumla to cells with formula in them already

I

iVassh

I need to add a round command to about 2500 cells and many of them hav
their own individual formula is there any way to add round to all o
them

I tried selecting them all and using ctrl+enter but that changed all th
formulas to the same so that didn't wor

what I want to end up with is thi

=round("whats already in this cell",0
 
G

Gord Dibben

Select the 2500 cells then run this macro.

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
 

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