Hello.

I have the following code, which executes just fine:

        Range(Cells(2, trackColumn + 2), Cells(lastRow, trackColumn + 2)).Formula = _
    "=SUMIF(" & Range(Cells(1, trackColumn - 1), Cells(lastRow, trackColumn - 1)).Address & "," & Replace(Cells(2, trackColumn).Address, "$", "") & ")"
The problem is that I need to run this again in a different column, and the data is held in another sheet that I have given the variable StepTwo to.

I'm not sure of the syntax to do this. Basically - this is what I need the code to do:

        Range(Cells(2, trackColumn + 2), Cells(lastRow, trackColumn + 2)).Formula = _
    "=SUMIF(" & StepTwo.Sheets(1).Range(Cells(1, trackColumn - 1), Cells(lastRow, trackColumn - 1)).Address & "," & StepTwo.Sheets(1).Replace(Cells(2, trackColumn).Address, "$", "") & ")"
Understandably this is totally incorrect, but it's the best I can do to explain what I'm actually trying to do....

The two parts of SUMIF are both held in a workbook that I've given the variable "StepTwo" to.
Both sets of data are also held on Sheet(1) of that workbook.

Help?