FormulaR1C1 using variables

  • Thread starter Thread starter Cheah
  • Start date Start date
C

Cheah

I want to do this but can't:

ActiveCell.FormulaR1C1 = "=MyFunction(R[variable]C[variable])"

What are my options?
 
Try something like

ActiveCell.FormulaR1C1 = _
"=MyFunction(R" & CStr(variable) & "C" & CStr(variable) & ")"

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
 
Don't forget your []'s:

Dim Var1 as long
dim Var2 as long

var1 = 21
var2 = 23
ActiveCell.FormulaR1C1 = "=MyFunction(R[" & var1 & "]C[" & var2 & "])"




I want to do this but can't:

ActiveCell.FormulaR1C1 = "=MyFunction(R[variable]C[variable])"

What are my options?
 
Back
Top