Hi,

I'm working on automatically populating data into a report, and just when i thought I figured it out, it doesn't seem to work....
I have 7 columns where, at the bottom of each folumn - in the first empty cell, I need to enter a formula.

I've come up with the below, but the repetative 'Dim Lastrow as Long' is not appreciated by Excel.
Also, for some reason it is not shifting columns, while it should...... (all formula's are entered on column A)

Anyone have any brilliant thoughts on this one?


Dim Lastrow as Long
Lastrow = Cells(Rows.Count, 1).End(xlUp).Row
ActiveCell.FormulaR1C1 = "=NOW()"

Dim Lastrow as Long
Lastrow = Cells(Rows.Count, 2).End(xlUp).Row
    ActiveCell.FormulaR1C1 = "=SUMIFS('WED Shipping report'!C[21], 'WED Shipping report'!C[17], ""CBL"")"

Dim Lastrow as Long
Lastrow = Cells(Rows.Count, 3).End(xlUp).Row
    ActiveCell.FormulaR1C1 = "=SUMIFS('WED Shipping report'!C[20], 'WED Shipping report'!C[16], ""CBL"", 'WED Shipping report'!C[34], ""<>N-*"")"

Dim Lastrow as Long
Lastrow = Cells(Rows.Count, 4).End(xlUp).Row
    ActiveCell.FormulaR1C1 = "=RC[-1]/RC[-2]"

Dim Lastrow as Long
Lastrow = Cells(Rows.Count, 5).End(xlUp).Row
    ActiveCell.FormulaR1C1 = "=SUMIFS('WED Shipping report'!C[18], 'WED Shipping report'!C[14], ""<>CBL"")"

Dim Lastrow as Long
Lastrow = Cells(Rows.Count, 6).End(xlUp).Row
    ActiveCell.FormulaR1C1 = "=SUMIFS('WED Shipping report'!C[17], 'WED Shipping report'!C[13], ""<>CBL"", 'WED Shipping report'!C[31], ""<>N-*"")"

Dim Lastrow as Long
Lastrow = Cells(Rows.Count, 7).End(xlUp).Row
    ActiveCell.FormulaR1C1 = "=RC[-1]/RC[-2]"