Results 1 to 9 of 9

Thread: *RESOLVED* last cell

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    right here
    Posts
    87

    Thumbs up *RESOLVED* last cell

    This is my code:

    VB Code:
    1. Dim lastcell As String
    2.  
    3.     ActiveWorkbook.Save
    4.    
    5.     lastcell = (ThisWorkbook.Worksheets("Hoofdstukken").Cells.SpecialCells(xlCellTypeLastCell).Row) + 1
    6.    
    7.     ThisWorkbook.Worksheets("Hoofdstukken").Range("L" & lastcell).Select
    8.     ActiveCell.Formula = "=SUM(" & "L2" & ":" & "L" & lastcell - 1 & ")"
    9.    
    10.     ActiveCell.Offset(0, 1).Activate
    11.     ActiveCell.Formula = "=SUM(" & "M2" & ":" & "M" & lastcell - 1 & ")"
    The user enters some information in the cells with a form I have made.
    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
    Last edited by brianbaart; Dec 31st, 2004 at 03:47 AM.
    If Not Now Then When

    If Not Here Then Where

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width