Sub GetTotals()
' hiker95, 10/11/2014, ME811068
Dim r As Long, lr As Long, c As Long, lc As Long
Dim v As String, h As String
Application.ScreenUpdating = False
lr = Cells(2, 1).End(xlDown).Row
lc = Cells(1, 2).End(xlToRight).Column
Range(Cells(1, lc + 3), Cells(lr + 3, lc + 3)).ClearContents
Range(Cells(lr + 3, 1), Cells(lr + 3, lc + 3)).ClearContents
Cells(1, lc + 3).Value = "Total"
Cells(lr + 3, 1).Value = "Total"
v = ""
For c = 2 To lc
For r = 2 To lr
If r = 2 Then
v = "=" & Cells(r, c).Value & "+"
Else
v = v & Cells(r, c).Value & "+"
End If
Next r
If Right(v, 1) = "+" Then v = Left(v, Len(v) - 1)
Cells(lr + 3, c) = v
v = ""
Next c
h = ""
For r = 2 To lr
For c = 2 To lc
If c = 2 Then
h = "=" & Cells(r, c).Value & "+"
Else
h = h & Cells(r, c).Value & "+"
End If
Next c
If Right(h, 1) = "+" Then h = Left(h, Len(h) - 1)
Cells(r, lc + 3) = h
h = ""
Next r
Columns(1).Resize(, lc + 3).AutoFit
Application.ScreenUpdating = True
End Sub