ExcelPupper
Board Regular
- Joined
- Mar 2, 2020
- Messages
- 112
- Office Version
- 2019
- Platform
- Windows
Hi, I always encounter this prompt message every time I run my code below. Is there a code that automatically clicks "OK" once it appears? Btw, it appears twice because I made 2 subtotals for two different columns. Thanks!
VBA Code:
Sub Subtotal()
Dim Lastrow As Long
' Subtotal per Customer and Class
Sheets(1).Activate
Lastrow = Range("A" & Rows.Count).End(xlUp).Row
Range("A1:N" & Lastrow).Select
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(6, 11, 12) _
, Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Range("A1:N" & Lastrow + 5).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Subtotal GroupBy:=10, Function:=xlSum, TotalList:=Array(6, 11, 12 _
), Replace:=False, PageBreaks:=False, SummaryBelowData:=True
End Sub