VBA code to perofrm "do not show subtotal"

Hello Everyone,

I am trying to get vba code using record macro to click “Do not show subtotal”
image

When I do record macro, it gives code like this

Can anyone provide a better solution to this?

Hi @Mohammad.Fuad

Check the below thread for better understanding,

Hope it helps!!

An alternative solution would be to create a template and just use a copy of your template with every run.

Hi @Mohammad.Fuad

Try this:

Sub DoNotShowSubtotal()
    Dim ws As Worksheet
    Dim rng As Range   
    Set ws = ThisWorkbook.Sheets("Sheet1") 
    Set rng = ws.Range("A1:D10") 
    rng.Subtotal GroupBy:=1, Function:=xlNone, TotalList:=Array(1), _
        Replace:=False, PageBreaks:=False, SummaryBelowData:=True
End Sub

**Note: Enable Macro in Excel.

Hope it will helps you :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.