Professional > Table scripting > Table presentation > Hiding rows, columns, and cells > Hide rules based on a single row or column > Hiding based on first or last row or column
 
Hiding based on first or last row or column
Instead of specifying the row or column on which the hide rule is based by name, you can specify that the test should apply to the first or last row or column in the table. This is useful if you have tracking studies that are regularly updated with new rows or columns containing data for the latest month or quarter. For example, you may have a table containing data for customer satisfaction by month, where a new element is added to the variable each month with the new responses. You can set a hide rule based on the value of the last column in the table, so that you do not need to change the element name in the table specification each time the new month's data is added.
To do this, use the ElementRef parameter with the keyword first or last instead of the name of the element:
Set Rule = .Rules.AddNew()
Rule.Type = 0 ' hide
Rule.Target = 0 ' row
Rule.CellItemRef = 0 ' if cellitem 0
Rule.Operator = 0 ' is less than
Rule.Value = 20 ' 20
Rule.ElementRef = "last" ' for the final column in the table
End With
The table bases the hide rule on the final column in the table, so when a new column is added to the end of the table, this is used instead.
See also
Hide rules based on a single row or column