Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Image references in a cell Jim Fidler Excel Programming 0 November 17th 09 05:52 AM
Using Dynamic Cell Address As Formula Location [email protected] Excel Worksheet Functions 4 March 6th 07 06:37 AM
dynamic cell references excel novice Excel Worksheet Functions 2 July 12th 05 02:59 PM
dynamic cell references in formulas CarolM Excel Programming 2 February 24th 05 07:49 PM
Dynamic Cell References jordanctc[_2_] Excel Programming 1 March 4th 04 04:08 PM


All times are GMT +1. The time now is 04:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"