Subtotal Method Example

This example creates subtotals for the selection on Sheet1. The subtotals are sums grouped by each change in field one, with the subtotals added to fields two and three.

Worksheets("Sheet1").Activate
Selection.Subtotal groupBy:=1, function:=xlSum, _
    totalList:=Array(2, 3)