For first row it would be =G2-I2 for second row =G3-I3 for third row =G4-I4
I would like to clarify few things with your scenario
- First write cell activity will not take a range
And as I can see in the image we have mention as J2:J99
It can take only one cell like
- Second is when we want to drag a formula to entire column then use Autofill activity
For more details have a view on these steps
- Drag and Drop an Excel application Scope Activity from the activities panel to the designer panel as shown below:
Drag and Drop a Write cell activity from the activities panel to the designer panel to write the formula in the required column.
Drag and Drop Auto fill range activity from activities panel to the designer panel as shown below:
In write cell activity we used a simple formula that adds both values which are in column A and column B.
The formula is this =SUM(A2,B2)
This formula is written in the C column and applied to the rest of the column by using autofill range activity.
Let’s see the required properties for auto fill range activity:
- FillRange: Provide the cell range that we need to fill that formula as shown above.
- SheetName: Provide the sheet name that you want this to happen.
- SourceRange: Provide the cell value where the formula is written.
I have tried your problem and I think I have found a solution for it.
Instead of using Workbook Write Cell, try using Excel Application Scope Write Cell.
Write your range as "J2:J99"
and put your formula as "=(G2-I2)"
This will update the formula for the whole range dynamically.
I hope this helps you.