![]() |
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. |
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. |
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. . |
All times are GMT +1. The time now is 02:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com