Hide rules based on a single row or column

Instead of hiding rows or columns where all the values in the row or column meet the condition, you can base the condition on a specific row or column on the table. For example, in the following table of interest by age, a column has been added to show the mean age:

The following script hides rows in this table where the value in the mean age column is 30 or over. To do this, you use the ElementRef parameter to specify the element age{mean} as the test for the hide rule.

With Tables.AddNew("Table8", "interest * age{.., mean()}", _

"Interest by Age, hide rows based on value in mean age column")

Set Rule = .Rules.AddNew()

Rule.Type = 0 ' hide

Rule.Target = 0 ' row

Rule.CellItemRef = 0 ' if cellitem 0

Rule.Operator = 3 ' is greater than or equal to

Rule.Value = 30 ' 30

Rule.ElementRef = "age{mean}" ' for column mean()

End With

"Interest by Age, hide rows based on value in mean age column")

Set Rule = .Rules.AddNew()

Rule.Type = 0 ' hide

Rule.Target = 0 ' row

Rule.CellItemRef = 0 ' if cellitem 0

Rule.Operator = 3 ' is greater than or equal to

Rule.Value = 30 ' 30

Rule.ElementRef = "age{mean}" ' for column mean()

End With

Here is the table produced by the script.

See also Adding a minimum p value to a table for an example of using hide rules based on the minimum p-value to hide non-significant values on a table.

See also