ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace Loop (https://www.excelbanter.com/excel-programming/283262-replace-loop.html)

Darrell[_4_]

Replace Loop
 
I am looking for helping in creating a loop that will
replace part of a formula in selected cells with the next
sequential number.
Ie. If the cell formula is =B4 then replace it with B5.
The selection will have a variety of columns, but the row
will always be the same.
I then want to print and do the replace again for the
next row of data.

Thank you for your assistance.

Darrell

Tom Ogilvy

Replace Loop
 
I suspect the real formula is more complex than =B4. If so, it would be
easier to use another cell that holds the row number, then rather than using
=B4
use
=Indirect("B"&z1)

where z1 holds the value 4.

or instead of sum(B4:B100) use sum(Indirect("B" & Z1 & ":B100")

Then all you need to do is update the value in Z1

range("Z1").Value = Range("Z1").Value + 1

--
Regards,
Tom Ogilvy

"Darrell" wrote in message
...
I am looking for helping in creating a loop that will
replace part of a formula in selected cells with the next
sequential number.
Ie. If the cell formula is =B4 then replace it with B5.
The selection will have a variety of columns, but the row
will always be the same.
I then want to print and do the replace again for the
next row of data.

Thank you for your assistance.

Darrell





All times are GMT +1. The time now is 09:43 AM.

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