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.
|