ListDataFormat.DefaultValue Property (Excel)

Returns Variant representing the default data type value for a new row in a column. The Nothing object is returned when the schema does not specify a default value. Read-only Variant .

Syntax

expression. DefaultValue

expression A variable that represents a ListDataFormat object.

Remarks

This property is used only for tables linked to a Microsoft SharePoint Foundation site.

In Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example displays the setting of the DefaultValue property for the third column of the table in Sheet1 of the active workbook. This code requires a list linked to a SharePoint site.

Sub ShowDefaultSetting() 
 Dim wrksht As Worksheet 
 Dim objListCol As ListColumn 
 
 Set wrksht = ActiveWorkbook.Worksheets("Sheet1") 
 Set objListCol = wrksht.ListObjects(1).ListColumns(3) 
 
 If IsNull(objListCol.ListDataFormat.DefaultValue) Then 
 MsgBox "No default value specified." 
 Else 
 MsgBox objListCol.ListDataFormat.DefaultValue 
 End If 
End Sub

See also

ListDataFormat Object