Dear Users of Excel Forum

I am not an experienced user of Excel VBA, so my question might be an easy one.

My VBA code is generating a table of a certain size chosen by the user. Basicly the code just creates the graphics of that table, not the content. In one cell I want the average of the content (still not available) of a number of cells to be calculates. If I was doing it manually without any code, I would write a formula in that cell. Let's say I wanted to place the average og the cells A1 to A10 in the cell A11, I would just write the following formula in the cell A11:

=average(A1:A10)

and it would work perfectly. Now however I want my VBA code to automatically put that formula into a cell. My problem is that I don't know how to reference that cell. Notice that the row numbers and column numbers of the cells involved are contained in certains variables I have defined.

NB! I know how to calculate the average of the cells directly in the VBA code, but I need the formula to be placed in the actual cell, else the average won't be updated when the user fill in the content of the table - long time after the table has been created by the VBA code.

I hope someone can help me.

Regards,

Erik V.