Thanks for the answer Andrew. The thing is that the formula depends on the parameters, which will change from time to time. Therefore, I need a formula where the ranges are given by the parameters. I tried something like the following, but had to give up cause I simply couldn't figure out how to do it.
.FormulaR1C1 = "=SUMIF(R[" & -(lastRow - actRow + 3) & "]C[" & actCol & "]:R[" & actRow & "]C[" & lastCol & "],R12C&""*"",R[-6]C5:R[-6]C11)".......
or
.Formula = "=sumif(" & Cells(actRow, actCol).Address & ":" & Cells(actRow, lastCol).Address & ";" & Cells(lastRow + 3, _
Application.Cells().Column).Value & "" * "" & ";" & Cells(actRow + 1, actCol).Address & ":" & Cells(actRow + 1, lastCol).Address & ")"
Bookmarks