DataBodyRange Property

Microsoft Office Web Components Visual Basic

DataBodyRange Property

Returns the databound rows from a specified ListObject object as a Range object. Read-only Range.

expression .DataBodyRange

expression    Required. An expression that returns a ListObject object.

Remarks

Some Range properties and methods are not supported. The properties not supported are Locked, MergeArea and MergeCells. The methods not supported are Delete, Insert, Merge, and UnMerge. The DataBodyRange does not include the HeaderRowRange property (the header row above the data bound rows) or the InsertRowRange property (the insert row below the data bound rows).

Note that if you want to set colors on rows, you can only do so on entire rows within the XML list. You cannot set the color of the insert row.

Example

This example sets the interior color of the DataBodyRange of a ListObject object to yellow and the border color to red.

    Dim rngDataBody
    
' Set a variable to the data body range.
Set rngDataBody = Spreadsheet1.ActiveSheet.ListObjects(1).DataBodyRange
    
' Set the interior color and the border color of the data body range.
With rngDataBody
    .Interior.ColorIndex = 6
    .Borders.ColorIndex = 3
End With