You can find out the last row based on a column which has data.
For example, based on column B.
With that you can get the range for the formula.
However, there's actually another problem - your formula isn't right.
You wouldn't use Application.WorksheetFunction or ActiveCell in the formula, they won't be recognised on the worksheet.
What you need is the formula as it would be written in a cell on the worksheet.
That might look something like this.
By the way, I know that formula is wrong, it's just for illustration.
Bookmarks