The problem seems to be in the line Cells(lngLastColumn + 1, lngRow).Formula = "=Sum(" & Cells(1, lngRow).Address & ":" & _
Cells(lngLastColumn, lngRow).Address & ")"
I think , here you have to use Cells(lngRow,lngLastColumn + 1).
My suggestion is to use activesheet.usedrange.rows.count instead of Range.End(xlToRight) and the like statements.
Please revert back if you have any qurties