Creating a formula which references a dynamic cell location
I have a routine for which variables "t" & "s" have a value.
I would like Visual Basic to be able to enter a formula into the active cell so that it equals whatever value may be contained in cells (t,s) of the worksheet. I tried: Activecell.FoumulaR1C1 = "=R[t]C[s]" but it is not working. Any ideas would be much appreciated. |
Creating a formula which references a dynamic cell location
Try:
activecell.formular1c1 = "=r[" & t & "]c[" & s & "]" Darren wrote: I have a routine for which variables "t" & "s" have a value. I would like Visual Basic to be able to enter a formula into the active cell so that it equals whatever value may be contained in cells (t,s) of the worksheet. I tried: Activecell.FoumulaR1C1 = "=R[t]C[s]" but it is not working. Any ideas would be much appreciated. -- Dave Peterson |
Creating a formula which references a dynamic cell location
On Sun, 23 May 2010 03:30:42 -0700 (PDT), Darren
wrote: I have a routine for which variables "t" & "s" have a value. I would like Visual Basic to be able to enter a formula into the active cell so that it equals whatever value may be contained in cells (t,s) of the worksheet. I tried: Activecell.FoumulaR1C1 = "=R[t]C[s]" but it is not working. Any ideas would be much appreciated. In the future, it will be helpful if you always tell us what you mean when you write "it is not working". It may not always be obvious to those trying to help you. In any event, you probably want one of the following: ActiveCell.FormulaR1C1 = "=R[" & t & "]C[" & s & "]" or ActiveCell.Offset(1, 0).FormulaR1C1 = "=R" & t & "C" & s depending on whether "t" and "s" are absolute references, or relative to ActiveCell. --ron |
Creating a formula which references a dynamic cell location
On May 23, 9:18*pm, Ron Rosenfeld wrote:
On Sun, 23 May 2010 03:30:42 -0700 (PDT), Darren wrote: I have a routine for which variables "t" & "s" have a value. I would like Visual Basic to be able to enter a formula into the active cell so that it equals whatever value may be contained in cells (t,s) of the worksheet. I tried: Activecell.FoumulaR1C1 = "=R[t]C[s]" but it is not working. Any ideas would be much appreciated. In the future, it will be helpful if you always tell us what you mean when you write "it is not working". *It may not always be obvious to those trying to help you. In any event, you probably want one of the following: ActiveCell.FormulaR1C1 = "=R[" & t & "]C[" & s & "]" or ActiveCell.Offset(1, 0).FormulaR1C1 = "=R" & t & "C" & s depending on whether "t" and "s" are absolute references, or relative to ActiveCell. --ron Thanks Gentleman. That did the trick. Sorry for the vagueries - I'll be more specific next time. |
All times are GMT +1. The time now is 01:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com