I have created a macro to calculate the earliest date using max, also the sum of the columns and and if statement to stop throwing an error if divide by zero occurs.

My problem is that I do these calculations on database dump into a worksheet. Each time this dump occurs the number of rows in the worksheet vary and that is where I am stuck.

For instance my MAX calculation is based on relative positioning and looks like this "=MAX(R[-7]C:R[-1]C)"

It is always R[-1]C as it calculates to the current row where the answers appear, hence [-1], and from row 2 as headings are in row 1. The above example has 8 rows of data.

What I do right now is - before I run macro is do a search on -7 and replace with -28 if there are 29 rows etc.

What I want is a complete macro...thanks in advance.