Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sum on Visible Cells (XL97/SR2)

    Is it possible to only sum on visible cells? As an example Cells A1 to A3 contain the following values 1,2,3. Row 2 is hidden therefore the sum on visible cells would be 4 not 6(all 3 rows).

  2. #2
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sum on Visible Cells (XL97/SR2)

    Wow! I'm impressed..Microsoft actually had something on this:

    Function Sum_Visible_Cells(Cells_To_Sum As Object)
    Application.Volatile
    For Each cell In Cells_To_Sum
    If cell.Rows.Hidden = False Then
    If cell.Columns.Hidden = False Then
    total = total + cell.Value
    End If
    End If
    Next
    Sum_Visible_Cells = total
    End Function

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Sum on Visible Cells (XL97/SR2)

    Also, for general manipulation of only visible cells:

    Goto, Special, Visible Cells only

    or

    SpecialCells(xlCellTypeVisible)
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Sum on Visible Cells (XL97/SR2)

    If the cells are hidden as a result of an Auto Filter using the SUBTOTAL() function only operates on visible cells. It also has a function index to indicate what operation to carry out, SUM, COUNT, AVERAGE etc.

    Andrew C

Posting Permissions

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