Hi,
I am trying to use a Defined variable range inside a VBA Script SumIf.
A sample of the code is:
Range("C7").Select
ActiveCell.FormulaR1C1 = "=SUMIF(Sheet2!R[-6]C[-2]:R[515]C[7],1101,Sheet2!C)"
I would like to Replace Sheet2!R[-6]C[-2]:R[515]C[7] with a Range Variable called myRange.
I have defined the variable as follows:
Dim MyRange As Range
Set MyRange = Worksheets("Sheet2").Range("A1:J512")
However when I try to the replacement I get a NAME error when running the VBA Macro.
Any suggestions?
Thanks,
Scott