XmlMappedRange.SpecialCells Method
Gets a Range that represents all the cells that match the specified type and value.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
Function SpecialCells ( _
Type As XlCellType, _
Value As Object _
) As Range
Range SpecialCells(
XlCellType Type,
Object Value
)
Parameters
Type
Type: Microsoft.Office.Interop.Excel.XlCellTypeThe cells to include.
Can be one of the following XlCellType values:
xlCellTypeAllFormatConditions. Cells of any format.
xlCellTypeAllValidation. Cells having validation criteria.
xlCellTypeBlanks. Empty cells.
xlCellTypeComments. Cells containing notes.
xlCellTypeConstants. Cells containing constants.
xlCellTypeFormulas. Cells containing formulas.
xlCellTypeLastCell. The last cell in the used range.
xlCellTypeSameFormatConditions. Cells having the same format.
xlCellTypeSameValidation. Cells having the same validation criteria.
xlCellTypeVisible. All visible cells.
Value
Type: System.ObjectIf Type is either xlCellTypeConstants or xlCellTypeFormulas, this argument is used to determine which types of cells to include in the result. These values can be added together to return more than one type. The default is to select all constants or formulas, no matter what the type. Can be one of the following XlSpecialCellsValue values:
Return Value
Type: Microsoft.Office.Interop.Excel.Range
A Range that represents all the cells that match the specified type and value.
Remarks
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example uses the SpecialCells method to get and select the range of cells that contain comments within an XmlMappedRange. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.
Private Sub SelectRangeWithComments()
Me.CustomerLastNameCell.AddComment(("This cell contains " & _
"a last name."))
Dim range1 As Excel.Range = Me.CustomerLastNameCell.SpecialCells( _
Excel.XlCellType.xlCellTypeComments)
range1.Select()
End Sub
private void SelectRangeWithComments()
{
this.CustomerLastNameCell.AddComment("This cell contains " +
"a last name.");
Excel.Range range1 = this.CustomerLastNameCell.SpecialCells(
Excel.XlCellType.xlCellTypeComments);
range1.Select();
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.