![]() |
Creating a formula using the loop variable
I wish to something I think is simple. In a loop, write formulas in a series of horizontal cells, referencing a series of vertical cells My attempt: For ii = 1 To 11 ActiveCell.Offset(12, ii).FormulaR1C1 = "=R[" & ii & "]C[-1]" Next Which of course fails, but hopefully gives you the idea of what I want. I want the contents of those horizontal cells to end up like: =H21 =H22 =H23 =H24 Thanks! allan -- Spector ------------------------------------------------------------------------ Spector's Profile: http://www.excelforum.com/member.php...o&userid=15618 View this thread: http://www.excelforum.com/showthread...hreadid=271630 |
Creating a formula using the loop variable
Allan,
Try this With ActiveCell For ii = 1 To 11 .Offset(0, ii).FormulaR1C1 = "=R[" & ii + 20 - .Row & "]C[" & 8 - ii - .Column & "]" Next ii End With -- HTH RP "Spector" wrote in message ... I wish to something I think is simple. In a loop, write formulas in a series of horizontal cells, referencing a series of vertical cells My attempt: For ii = 1 To 11 ActiveCell.Offset(12, ii).FormulaR1C1 = "=R[" & ii & "]C[-1]" Next Which of course fails, but hopefully gives you the idea of what I want. I want the contents of those horizontal cells to end up like: =H21 =H22 =H23 =H24 Thanks! allan -- Spector ------------------------------------------------------------------------ Spector's Profile: http://www.excelforum.com/member.php...o&userid=15618 View this thread: http://www.excelforum.com/showthread...hreadid=271630 |
All times are GMT +1. The time now is 01:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com