hi i got the error message when i run this code, the problem is sum of each column not count. anyone know where the error is?
thx
[vba]
Sub jumlah()
Dim wsD As Worksheet
Dim wsT As Worksheet
Dim FinalRow As Long
Dim FinalCol As Long
Set wsD = ThisWorkbook.Worksheets("data")
Set wsT = Sheets.Add(After:=Sheets(Worksheets.Count))
wsT.Name = "total"
wsT.Range("A1:Z5000").ClearContents
FinalRow = wsD.Cells(Rows.Count, 1).End(xlUp).Row
FinalCol = wsD.Cells(1, Columns.Count).End(xlToLeft).Column
wsD.Range(wsD.Cells(1, 1), wsD.Cells(FinalRow, FinalCol)).Copy _
Destination:=wsT.Range("A4")
FinalRow = wsT.Cells(Rows.Count, 1).End(xlUp).Row
FinalCol = wsT.Cells(4, Columns.Count).End(xlToLeft).Column
wsT.Cells(FinalRow + 2, 1).Value = "Total"
wsT.Range(Cells(FinalRow + 2, 2), Cells(FinalRow + 2, FinalCol)) _
.FormulaR1C1 = "=Sum(R[" & -FinalRow + 3 & "]C:R[-2]C)"
End Sub
[/vba]