|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Databar.AxisPosition Property (Excel)
Returns or sets the position of the axis of the data bars specified by a conditional formatting rule. Read/write
The axis for data bars is displayed only when the AxisPosition property is either xlDataBarAxisAutomatic or xlDataBarAxisMidpoint, and when there are negative values in the range of values specified with a data bar conditional formatting rule. If the conditional formatting rule is created programmatically, the default value for the AxisPosition property is xlDataBarAxisNone. If the conditional formatting rule is created using the user interface, the default value for the AxisPosition property is xlDataBarAxisAutomatic.
The following code example selects a range of cells, adds data bar formatting, and then sets the axis position to display in the middle of the cells when negative values are present.