Select "OK" in sort warning box

Muleskin57

New Member
Joined
Dec 22, 2016
Messages
23
I'm running a large macro that reformats a data dump from an accounting system. It sorts several times and subtotals. During the running of the macro, I get an "error" message that Excel cannot determine the column header row. I have been hitting ENTER ("OK") and the macro moves on until the next instance of that command and I must hit ENTER or select "OK" for it to complete. How can I automate this macro completely, getting the offending stoppages to cease?
 
yes, there is a header row, but I think it's outside the range. Perhaps if I expanded the range? It works so well now with the exception of the CR issue, I'm hesitant to change much.
 
Last edited:
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try adding the two lines in blue as shown
Code:
Sheets("DATA DUMP").Select
Cells.Select
[COLOR=#0000ff]Application.DisplayAlerts = False[/COLOR]
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(6, 7, 14, _
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(6, 7, 14, _
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(6, 7, 14, _
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Range("A1").Select
Sheets("DATA DUMP (Exp)").Select
Cells.Select
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(6, 7, 14, _
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(6, 7, 14, _
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(6, 7, 14, _
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
[COLOR=#0000ff]Application.DisplayAlerts = True[/COLOR]
Range("A1").Select
Sheets("DATA DUMP").Select
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,252
Messages
6,129,717
Members
449,529
Latest member
SCONWAY

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