Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Aug 2001
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sum a Range (2000)

    Hello all, I've found the top cell and the bottom cell of a column range I wish to sum, in the following manner:

    Set TopCell = Range("A1").Offset(1, N)
    Set BottomCell = Range("A1").Offset(lLastRow, N)

    Now how can I use these two Range variables to find the sum across this range? I want to set another cell to report the sum of this range.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Sum a Range (2000)

    To put it in cell E5

    Range("E5") = Application.WorksheetFunction.sum(range(topcell,bo ttomcell))

    Steve

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sum a Range (2000)

    If you want to put a formula in cell B1 on Sheet1 that will sum those cells, you could use:

    <pre> Worksheets("Sheet1").Range("B1").Formula = "=SUM(" & TopCell.Address(False, False) _
    & ":" & BottomCell.Address(False, False) & ")"
    </pre>

    Legare Coleman

Posting Permissions

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