PC Review


Reply
Thread Tools Rate Thread

Creating a formula which references a dynamic cell location

 
 
Darren
Guest
Posts: n/a
 
      23rd May 2010
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.
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      23rd May 2010
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
 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      23rd May 2010
On Sun, 23 May 2010 03:30:42 -0700 (PDT), Darren <(E-Mail Removed)>
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
 
Reply With Quote
 
Darren
Guest
Posts: n/a
 
      24th May 2010
On May 23, 9:18*pm, Ron Rosenfeld <ronrosenf...@nospam.org> wrote:
> On Sun, 23 May 2010 03:30:42 -0700 (PDT), Darren <dar...@ptpartners.net.au>
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Cell References in Excel nogga Microsoft Excel Misc 2 23rd Mar 2009 07:21 PM
Using Dynamic Cell Address As Formula Location sven.halb@gmail.com Microsoft Excel Worksheet Functions 4 6th Mar 2007 06:37 AM
dynamic cell references excel novice Microsoft Excel Worksheet Functions 2 12th Jul 2005 02:59 PM
dynamic cell references in formulas =?Utf-8?B?Q2Fyb2xN?= Microsoft Excel Programming 2 24th Feb 2005 07:49 PM
Creating a formula that references the formula in another cell robin.chappell Microsoft Excel Misc 1 21st Aug 2004 09:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:49 PM.