LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default rounding a formula in a cell, then replace the formula

Hi
try the following macro
sub replace_formula()
dim oldform
dim newform
dim rng as range
dim cell as range
set rng=range("A1:A50")
for each cell in rng
if cell.hasformula then
oldform=cell.formula
newform = "=ROUND(" & right(oldform,len(oldform)-1) & _
",2)"
cell.formula=newform
end if
next
end sub


--
Regards
Frank Kabel
Frankfurt, Germany


Robert wrote:
I want to round 50 plus cells with the rounding formula. I want to
select the cell, enter the rounding formula that will round the
formula already in the cell and replace the original formula.
Example C10*C15 to ROUND(C10*C15,2). I tried doing this with a macro
and it doesn't work. The macro changes the original formula.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use Formula to Replace A Cell opieandy Excel Discussion (Misc queries) 3 July 5th 09 08:20 PM
Replace Cell Value with Formula MaryMalone Excel Discussion (Misc queries) 3 May 6th 08 08:08 PM
rounding when referencing a cell with a formula? [email protected] Excel Worksheet Functions 5 February 29th 08 07:52 PM
rounding a number with a formula already in cell CIW Excel Worksheet Functions 1 November 29th 07 05:20 PM
rounding down another cell with a formula Steve Excel Worksheet Functions 3 January 6th 06 06:34 PM


All times are GMT +1. The time now is 10:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"