Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ActiveCell.Formula

Hello,

Does anyone know how to (inVBA) create

Range("B5").Select
ActiveCell.FormulaR1C1 = "=Test1!R[-3]C[2]"
Range("A4").Select

Where Test1 can be a variable.

I want to be able to enter formulas in cells but I want to
be able to use variables in the formulas. I do not want
to use UDF's so that the user can see the actual formula
used to obtain the result when that particular cell is
active. Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ActiveCell.Formula

s1 = "Test1"

Range("B5").Select
ActiveCell.FormulaR1C1 = "=" & S1 & "!R[-3]C[2]"
Range("A4").Select

or
s1 = "Test1"
r1 = -3
c1 = 2

Range("B5").Select
ActiveCell.FormulaR1C1 = "=" & S1 & "!R[" & r1 & "]C[" & c1 & "]"
Range("A4").Select


demo'd from the immediate window:
s1 = "Test1"
r1 = -3
c1 = 2
? "=" & S1 & "!R[" & r1 & "]C[" & c1 & "]"
=Test1!R[-3]C[2]


--
Regards,
Tom Ogilvy


"Matt P." wrote in message
...
Hello,

Does anyone know how to (inVBA) create

Range("B5").Select
ActiveCell.FormulaR1C1 = "=Test1!R[-3]C[2]"
Range("A4").Select

Where Test1 can be a variable.

I want to be able to enter formulas in cells but I want to
be able to use variables in the formulas. I do not want
to use UDF's so that the user can see the actual formula
used to obtain the result when that particular cell is
active. Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ActiveCell.Formula

Thanks again Tom.
-----Original Message-----
s1 = "Test1"

Range("B5").Select
ActiveCell.FormulaR1C1 = "=" & S1 & "!R[-3]C[2]"
Range("A4").Select

or
s1 = "Test1"
r1 = -3
c1 = 2

Range("B5").Select
ActiveCell.FormulaR1C1 = "=" & S1 & "!R[" & r1 & "]C[" &

c1 & "]"
Range("A4").Select


demo'd from the immediate window:
s1 = "Test1"
r1 = -3
c1 = 2
? "=" & S1 & "!R[" & r1 & "]C[" & c1 & "]"
=Test1!R[-3]C[2]


--
Regards,
Tom Ogilvy


"Matt P." wrote in

message
...
Hello,

Does anyone know how to (inVBA) create

Range("B5").Select
ActiveCell.FormulaR1C1 = "=Test1!R[-3]C[2]"
Range("A4").Select

Where Test1 can be a variable.

I want to be able to enter formulas in cells but I want

to
be able to use variables in the formulas. I do not want
to use UDF's so that the user can see the actual formula
used to obtain the result when that particular cell is
active. Thank you.



.

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
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
ActiveCell.Formula and IF statement David Excel Programming 1 June 28th 04 01:16 PM
ActiveCell.Formula Syntax Notorious_F.A.T Excel Programming 2 April 5th 04 10:15 AM
activecell.formula syntax Larry Levinson Excel Programming 4 December 23rd 03 01:33 PM
Formula with an ActiveCell Sok Hong Excel Programming 3 August 14th 03 08:24 AM


All times are GMT +1. The time now is 03:05 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"