SubTotal

     

  • We can SubTotal based on category
  •  

     

    Parameters of SubTotal

     

    GroupBy:Denotes about Column starting from 1, left to right

     

  • Count starts from left to right
  •  

    XlConsolidationFunction

  • XlAverage,Xlsum,Xlcount,Xlproduct,,XlMax,XlMin,..
  •  

    TotalList

  • Denotes about the columns to Sub-Total
  •  

    Replace

  • True:replace existing subtotal with new one
  • False:To add additional subtotal to existing subtotals
  •  

    Pagebreaks

  • True:To place pagebreaks for each group
  •  

    SummaryBelowdata

  • True:To place the SUMMARY below subtotal
  • False:To place the SUMMARY above subtotal
  •  

    Private Sub CommandButton1_Click()
    Range("A1").CurrentRegion.Subtotal _
    GroupBy:=2, _
    Function:=xlSum, _
    TotalList:=Array(4, 5), _
    Replace:=True
    End Sub

     

     

    Download The Workbook

     

    Sub Total and Grand Total

     

  • Click on the image to watch the video
  •  

    Download The Workbook