![]() |
Broken macro in Excel 2003: part II
I posted on this once before and got some advice that I've followed up on
(thanks!) I sp1 installed and tried the registry edit mentioned in article 831824, but no luck there so I've set it back to its original setting. I think I've come up with some of the offending code that ran well in Excel 2000 but breaks in Excel 2003. As of the first line of this code, all of the applicable data is selected, but by the time it gets to the end there are many rows that fall below the bottom of the selection. ' Subtotal by company name Range("A5", Range("A5").End(xlDown).End(xlToRight)).Select Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(5), _ Replace:=False, PageBreaks:=False, SummaryBelowData:=True Range("A5", Range("A5").End(xlToRight).End(xlDown)).Select Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(5), _ Replace:=False, PageBreaks:=False, SummaryBelowData:=True Any ideas that you can provide will be greatly appreciated. |
Broken macro in Excel 2003: part II
Actually I see now why that is so never mind. Sorry, I'll keep hunting
"kmbarz" wrote: I posted on this once before and got some advice that I've followed up on (thanks!) I sp1 installed and tried the registry edit mentioned in article 831824, but no luck there so I've set it back to its original setting. I think I've come up with some of the offending code that ran well in Excel 2000 but breaks in Excel 2003. As of the first line of this code, all of the applicable data is selected, but by the time it gets to the end there are many rows that fall below the bottom of the selection. ' Subtotal by company name Range("A5", Range("A5").End(xlDown).End(xlToRight)).Select Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(5), _ Replace:=False, PageBreaks:=False, SummaryBelowData:=True Range("A5", Range("A5").End(xlToRight).End(xlDown)).Select Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(5), _ Replace:=False, PageBreaks:=False, SummaryBelowData:=True Any ideas that you can provide will be greatly appreciated. |
Broken macro in Excel 2003: part II
Success! Apparently when the macro would run in Excel 2000, there was a
blank line in between the last subtotal and the grand total. So, the original programmer (whoever that was) added the second line here to deal with that (which I fixed by commenting out. Net effect on Excel 2003 was that the last subtotal disappeared causing a corrupt report. Rows(SheetLastRow - 1).Select 'Selection.Delete Shift:=xlUp Columns("A:A").EntireColumn.AutoFit Columns("B:B").EntireColumn.AutoFit "kmbarz" wrote: I posted on this once before and got some advice that I've followed up on (thanks!) I sp1 installed and tried the registry edit mentioned in article 831824, but no luck there so I've set it back to its original setting. I think I've come up with some of the offending code that ran well in Excel 2000 but breaks in Excel 2003. As of the first line of this code, all of the applicable data is selected, but by the time it gets to the end there are many rows that fall below the bottom of the selection. ' Subtotal by company name Range("A5", Range("A5").End(xlDown).End(xlToRight)).Select Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(5), _ Replace:=False, PageBreaks:=False, SummaryBelowData:=True Range("A5", Range("A5").End(xlToRight).End(xlDown)).Select Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(5), _ Replace:=False, PageBreaks:=False, SummaryBelowData:=True Any ideas that you can provide will be greatly appreciated. |
All times are GMT +1. The time now is 12:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com