How to make a column of formulas all ROUND

C

Cobaum

I created a spreadsheet in which I have a column of formulas. Most of these
fomulas are simply pulling a single number off another sheet. I want to make
all the formulas ROUND versions of the existing formula without having to go
into each cell and making the change. They are not in order to which I can
just make the first fomula a ROUND fomula and copy down. So, is there a way
to select a range of cells and make the existing fomulas all ROUND versions?
Thanks.
 
G

Gord Dibben

Would this help?

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

If not post back with what you have in the "not in order" cells.


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