Consulting

Results 1 to 2 of 2

Thread: I have a dynamic SUM function problem

  1. #1

    Question I have a dynamic SUM function problem

    I am wanting to write the last bit of a macro.

    The problem is, its a web download of a report I have created in PHP.

    What I want to do, is SUM up say column 1 2 and 3 yea?

    But those columns could be from say 20-700 long, depends entirely on how many orders and products have been ordered that day.

    Is there anyway of doing this, like the totals are all at the bottom of the page not at the sides at all, so we wouldnt be going across, its like so:

    oder | product price
    order1 | product1 | 10
    order2 | product 2 | 10
    Total Price 20 -- this would be the formula but could be furtherdown or infact further up, depending on orders and products placed

  2. #2
    VBAX Mentor tpoynton's Avatar
    Joined
    Feb 2005
    Location
    Clinton, MA
    Posts
    399
    Location
    [vba]
    Public Sub sumPrice()
    Dim iRows As Integer
    With ActiveSheet
    iRows = .UsedRange.Rows.Count
    .Cells(iRows + 1, 3).Value = WorksheetFunction.Sum(.Range(.Cells(2, 3), .Cells(iRows, 3)))
    End With
    End Sub
    [/vba]
    if this doesnt do as you wish, provide a sample workbook to better illustrate

Posting Permissions

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