Col Delane
Active Member
- Joined
- Jan 14, 2014
- Messages
- 304
Using Microsoft Excel 2016 MSO 32-bit from Microsoft Office Professional Plus 2016.
I have a workbook that contains several sheets, one of which holds a structured Excel Table used to record individual investments.
The table includes various data entry columns as well as several calculation/formula columns.
Various sets of columns are Grouped into Column Outlines (i.e. there are several separate column Outlines, but all re at the same level = 2)
The purpose of the sheet_event macro below is to ensure that (irrespective of the user's Excel settings):
(1) the +/- Outline symbols are displayed on the sheet rather than the rows/columns be "hidden"
(2) the Summary Rows and Summary Columns are located ABOVE and RIGHT of the Grouped rows/columns respectively.
However, whenever any sheet holds an Excel Table and any of the rows and/or columns within that Table are Grouped, the last two code lines trigger the following errors, as applicable to the Outline axis:
“Run-time error 1004: Unable to set the SummaryRow property of the Outline class.”
“Run-time error 1004: Unable to set the SummaryColumn property of the Outline class.”
Note that if “normal” spreadsheet rows or columns (i.e. outside an Excel Table) are Grouped then the error does NOT occur.
Is anyone able to explain what’s going on (wrong) here and how I can overcome this problem (if possible)?
I have a workbook that contains several sheets, one of which holds a structured Excel Table used to record individual investments.
The table includes various data entry columns as well as several calculation/formula columns.
Various sets of columns are Grouped into Column Outlines (i.e. there are several separate column Outlines, but all re at the same level = 2)
The purpose of the sheet_event macro below is to ensure that (irrespective of the user's Excel settings):
(1) the +/- Outline symbols are displayed on the sheet rather than the rows/columns be "hidden"
(2) the Summary Rows and Summary Columns are located ABOVE and RIGHT of the Grouped rows/columns respectively.
Code:
Private Sub Worksheet_Activate()
Dim rowtst As Variant
Dim coltst As Variant
If ActiveWindow.DisplayOutline = False Then ActiveWindow.DisplayOutline = True
rowtst = ActiveSheet.Rows.OutlineLevel
coltst = ActiveSheet.Columns.OutlineLevel
If IsNull(rowtst) Then ActiveSheet.Outline.SummaryRow = xlAbove
If IsNull(coltst) Then ActiveSheet.Outline.SummaryColumn = xlRight
End Sub
However, whenever any sheet holds an Excel Table and any of the rows and/or columns within that Table are Grouped, the last two code lines trigger the following errors, as applicable to the Outline axis:
“Run-time error 1004: Unable to set the SummaryRow property of the Outline class.”
“Run-time error 1004: Unable to set the SummaryColumn property of the Outline class.”
Note that if “normal” spreadsheet rows or columns (i.e. outside an Excel Table) are Grouped then the error does NOT occur.
Is anyone able to explain what’s going on (wrong) here and how I can overcome this problem (if possible)?