Cells(intRow, 2 + j).Formula = "=SUM(C" & intRow & ":" & colName & intRow & ")"
This is the code I am using to put a basic SUM-functionality into the cells at the end of certain rows. Upon entering this formula in the cell, the cell shows "#NAME?". If i click into the formula and then press "Enter", the formula works as intended (the formula input is also correct).
Is there a way to make VBA update these cells automatically, so the formula works as soon as it's entered into the cell by VBA?
Edit: Example values for the variables are:
intRow = 5
j = 7 (Column G)
colName = H (refers to j + 1)
So the finished formula in cell K5 would be:
=SUM(C5:J5)
"=SUM(C" & intRow & ":" & colName & intRow & ")"
evaluate to? You need to post a minimal reproducible example. - John Coleman