I use a macro to insert a formula down a selected column. The data feild changes length every day so my macro either runs to far down which creates blank cells to print or not far enough so I have to manually extend its length. There is the occasional blank row that needs to be skipped but never more than 1, here is my current code.
Code:
ActiveCell.FormulaR1C1 = "UPC"
Range("P3").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-6]="""","""",((RC[-5]+RC[-4])/RC[-3]))"
Selection.AutoFill Destination:=Range("P3:P82"), Type:=xlFillDefault
Range("P3:P82").Select
Selection.NumberFormat = "0.00"
ActiveWindow.SmallScroll Down:=-100
End Sub