Hi I was given this formula on this board by a very kind person yesterday, it works perfectly when intorduced straight into the spreadsheet, however I want this formula to be added to a cell when a macro is run, this is easily achieved but I cannot find a way to substitute the row values in this formula to variables, does anybody know what syntax I need? thank you.
Basically I want to change this:
=IF(B2<>C2,SUMIF($B$2:B2,B2,$B$1:B1),"")
Into a working version of something like this:
For z = 6 To LastCol
Cells(X3, z).Formula = "=IF(FX2<>GX2,SUMIf($F$X2:FX2,FX2,$F$X1:FX1),"")"
Next z
Where X3 is the cell into which the formula goes, X2 and X1 are variables of row number.
Thanks.
Basically I want to change this:
=IF(B2<>C2,SUMIF($B$2:B2,B2,$B$1:B1),"")
Into a working version of something like this:
For z = 6 To LastCol
Cells(X3, z).Formula = "=IF(FX2<>GX2,SUMIf($F$X2:FX2,FX2,$F$X1:FX1),"")"
Next z
Where X3 is the cell into which the formula goes, X2 and X1 are variables of row number.
Thanks.