This is my code:
The user enters some information in the cells with a form I have made.VB Code:
Dim lastcell As String ActiveWorkbook.Save lastcell = (ThisWorkbook.Worksheets("Hoofdstukken").Cells.SpecialCells(xlCellTypeLastCell).Row) + 1 ThisWorkbook.Worksheets("Hoofdstukken").Range("L" & lastcell).Select ActiveCell.Formula = "=SUM(" & "L2" & ":" & "L" & lastcell - 1 & ")" ActiveCell.Offset(0, 1).Activate ActiveCell.Formula = "=SUM(" & "M2" & ":" & "M" & lastcell - 1 & ")"
Then pressing a button the above code is used.
But the problem is when the user delets some rows the lastcell value is stil the "old" one. So the totals are placed to low on the spreadsheet
Even when I save the workbook first.
Thanks in advance,
Brian




Reply With Quote