Subtotal customized summary.??

miqbal

New Member
Joined
Mar 7, 2018
Messages
11
Code:
Workbooks.Open ("X:\MyFile.xlsx")
Worksheets("Sheet1").Activate
Range("A1").CurrentRegion.Select
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(5, 6, 7)


above code working fine just want to know, is there any way I can assign or customized summary text in subtotal.?

for instance the above code only gives the value of columns 5, 6, 7 but I want it to display like below..

Column 5Column 6
Column 7
1
2
1
2
3
5
3 Products Entered
5 DeCertifications
6 Edits

<tbody>
</tbody>


I tried the below line but its not working.
Code:
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(5 & " products entered", 6 & " DeCetifications", 7 & " Edits)


Any way to workaround..???
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try incorporating this with your existing code as shown
Rich (BB code):
Dim i As Long
Dim myFormats As Variant

' Your existing code goes here

myFormats = Array(5, " products entered", 6, " DeCetifications", 7, " Edits")

ActiveSheet.Outline.ShowLevels RowLevels:=2
With Range("A1").CurrentRegion
  For i = LBound(myFormats) To UBound(myFormats) Step 2
      .Columns(myFormats(i)).SpecialCells(xlVisible).NumberFormat = Replace("General""#""", "#", myFormats(i + 1))
  Next i
End With
ActiveSheet.Outline.ShowLevels RowLevels:=3
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,245
Members
448,952
Latest member
kjurney

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top