+ Reply to Thread
Results 1 to 7 of 7

Simple Subtotal

Hybrid View

jdenys Simple Subtotal 11-08-2012, 03:07 PM
oeldere Re: Simple Subtotal 11-08-2012, 03:10 PM
jdenys Re: Simple Subtotal 11-08-2012, 03:15 PM
oeldere Re: Simple Subtotal 11-08-2012, 03:21 PM
jdenys Re: Simple Subtotal 11-08-2012, 03:26 PM
stnkynts Re: Simple Subtotal 11-08-2012, 03:44 PM
jdenys Re: Simple Subtotal 11-08-2012, 03:57 PM
  1. #1
    Registered User
    Join Date
    11-08-2012
    Location
    Detroit
    MS-Off Ver
    Excel 2003
    Posts
    4

    Simple Subtotal

    Hi, I am having difficulties with a subtotal formula in a macro that i need. My spread sheet looks like this



    Material Price Quantity
    AAAA 10.34 5
    BBBB 3.45 7
    CCCC 7.55 12

    I would like to put a subtotal at the bottom of Price as well as Quantity. I need this to either take the total number of rows, or look at the material row to find the bottom whichever is easier to do as my spreadsheets will have different amounts of rows.

    Thank You!!!

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Simple Subtotal

    You could use pivot table for that.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    11-08-2012
    Location
    Detroit
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Simple Subtotal

    Hi Oeldere, i need to include this part in a macro that I have built already.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Simple Subtotal

    why don't you record the manual actions, with the macro recorder.

    then you have the code.

  5. #5
    Registered User
    Join Date
    11-08-2012
    Location
    Detroit
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Simple Subtotal

    '
    Columns("A:A").Select
    Selection.End(xlDown).Select
    Range("A7").Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-6]C:R[-1]C)"
    Range("A8").Select
    End Sub


    How can I guarantee that it will pick up everything in the entire column because on each tab i have different amounts of rows

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Simple Subtotal

    I would try this on a test copy of you workbook since i didn't have specifics on locations of data. Should work across all worksheets. If you only want specific worksheets you will need to alter code.

    Sub Subtotals()
    Dim wksht As Long, lastrow As Long
    
    For wksht = 1 To Worksheets.Count
        lastrow = Sheets(wksht).Range("A" & Rows.Count).End(xlUp).Row
            If Not lastrow < 2 Then
                Sheets(wksht).Range("B" & lastrow + 2).FormulaR1C1 = "=SUM(R1C2:R" & lastrow & "C2)"
                Sheets(wksht).Range("C" & lastrow + 2).FormulaR1C1 = "=SUM(R1C3:R" & lastrow & "C3)"
            End If
    Next wksht
    
    End Sub

  7. #7
    Registered User
    Join Date
    11-08-2012
    Location
    Detroit
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Simple Subtotal

    Thank you Stnkynts!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1