You have the worksheet formula, which you would put in cell C2 and drag down. And you have the code which puts an R1C1 type formula in cells C2 down to the last row as determined by the number of cells in column A.
Alternatively, you could use:
Unless I really want/need to work out a complex formula in VBA and, perhaps more importantly, I already have a working formula in a cell, I will use that.
Select the cell with the formula, start the macro recorder, press F2 to enter Edit mode, press Enter, stop the macro recorder.
Change "ActiveCell" to be the cell/range where you want the formula and delete the Range(...).Select that will follow it. This gives you the R1C1 type formula. It's quite useful because it shows you where you need to double up on quotes, etc., although, in this case there aren't any. And, if you wish, you can then change FormulaR1C1 to Formula and copy in the formula from the cell ... making sure to double up quotes when you need to.
Regards, TMS
Bookmarks