I'm trying to make an automated sum based on an increasing number of rows.
Here is my sample of code but I'm stuck as I don't know the syntax to include a variable in the formula of a cell.
Sheets("Orderboek").Select
Range("H" & (rOi + 1)).FormulaR1C1 = "=Sum(H3:H"&rOi&")"
My variables are declared as follows:
Dim i As Integer, a As Range 'i= index a een gebied
Dim prText As String 'product text
Dim rOi As Long 'rij nummer in orderboek
Dim rng, sumrng As Excel.Range
Dim r As Long 'rij number in offerte
Dim Tot As Long 'totaal som van offerte
Dim ws As Excel.Worksheet
Thanks very much if you can help me out.