Generate Subtotal Summary from Sheet1 into Sheet2
Last stretch...
the above code works perfect.
Now, I am trying Rows Total and Columns Totals
....
....
Loop
End With
SH2.Select
SH2.Cells(k, "A") = "Grand Total": Rows("1:1").Font.Bold = True:
Range("B1:D1").HorizontalAlignment = xlRight
'Place row totals in Column D. Reference Error there
-----------------------------------------------------------------------------
For i = 2 To k
'SH2.Cells(i, "D").Value = Application.Sum(Range(Cells(i, "B"),
Cells(i, "C")))
Next i
'Place Columns totals in row k.
-------------------------------------------
For i = 2 To 4
SH2.Cells(k, i).Value = Application.Sum(Range(Cells(2, i), Cells(k,
i)))
Next i
Row(k).Font.Bold = True ' Error . How do I refer to the whole row with
a variable ?
Exit Sub
|