I am trying to get the returns of a stock after each close date and list it in a column. My problem is that the start and end dates change and any cell that is not used for returns has to be completely cleared of contents. Here is what I have so far.
Sheets("returns").Range("a2").FormulaR1C1 = _ "=IFERROR(returns(Imported!RC[4],Imported!R[1]C[4]),"""")" Sheets("returns").Range("a2").Select Selection.AutoFill Destination:=Range("a2:a937") Range("a2:a937").Select Sheets("returns").Range("c2").FormulaR1C1 = _ "=IFERROR(returns(Imported!RC[10],Imported!R[1]C[10]),"""")" Sheets("returns").Range("C2").Select Selection.AutoFill Destination:=Range("c2:c937") Range("C2:C937").Select This works for what I need but it leaves a formula in the empty cells which I can't have for the next step of my project. It also leaves a -1 return in the last row when I run out of data. The -1 return isn't too big of a deal if that can't be fixed. Is there a way to clear the contents of a cell that doesn't contain a value but contains a formula?