Hello,
I have a macro that imports a bunch a impedance numbers from each text file into their own column in the active worksheet, and then inserts some equations into other cells of the same column to show things such as averages, max, min, etc. Since each text file has a different amount of impedance numbers, the equations need to be relative to the column where they are located and also dynamic to cover the correct number of cells in their row. Here is an example of a working formula:
cl.Offset(2, 1).FormulaR1C1 = "=AVERAGE(R[+3]C:R[+100]C)"
Here is an example of what I would like to do:
cl.Offset(2, 1).FormulaR1C1 = "=AVERAGE(R[+3]C:R[+j]C)"
I have a loop just prior to this line of code that inserts the impedance numbers one at a time, so the loop counter (j) contains the amount of rows that the average equation needs to cover. VBA doesn't seem to like it when I replace the 100 with a variable. What is the correct way to do this? Thanks,
Adrian
Bookmarks