ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to change multiple formulae by looping (https://www.excelbanter.com/excel-programming/352054-how-change-multiple-formulae-looping.html)

pauluk[_75_]

How to change multiple formulae by looping
 

Hi All,

How can can i loop the below formula through a range of cells?

each cell contains a formula be it =N$1*$G119 or =5*$G119

how can i loop a to change the formula to =N$18*0.05 or =5*0.05

the range is N3:W284

I think i just need to loop the folloing through the range but have ha
no joyu as yet

ActiveCell.FormulaR1C1 = "=R1C*0.05"

I have tried:
For each cell in Range("N3:W284")
ActiveCell.FormulaR1C1 = "=R1C*0.05"
Next Cell

but it changes all the cells to the same formula rather then keepin
the left handside of the formula as it is and just deleting an
changing the right handside to 0.05

I help please.

Thanks
Pau

--
paulu

http://www.frontlineuk.co
-----------------------------------------------------------------------
pauluk's Profile: http://www.excelforum.com/member.php...nfo&userid=520
View this thread: http://www.excelforum.com/showthread.php?threadid=50720


Toppers

How to change multiple formulae by looping
 
Try:

For each cell in Range("N3:W284")
Cell.FormulaR1C1 = "=R1C*0.05"
Next Cell


"pauluk" wrote:


Hi All,

How can can i loop the below formula through a range of cells?

each cell contains a formula be it =N$1*$G119 or =5*$G119

how can i loop a to change the formula to =N$18*0.05 or =5*0.05

the range is N3:W284

I think i just need to loop the folloing through the range but have had
no joyu as yet

ActiveCell.FormulaR1C1 = "=R1C*0.05"

I have tried:
For each cell in Range("N3:W284")
ActiveCell.FormulaR1C1 = "=R1C*0.05"
Next Cell

but it changes all the cells to the same formula rather then keeping
the left handside of the formula as it is and just deleting and
changing the right handside to 0.05

I help please.

Thanks
Paul


--
pauluk

http://www.frontlineuk.com
------------------------------------------------------------------------
pauluk's Profile: http://www.excelforum.com/member.php...fo&userid=5208
View this thread: http://www.excelforum.com/showthread...hreadid=507209




All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com