Share via


XmlMappedRange.SpecialCells 方法

取得 Range,表示所有符合指定類型和資料的儲存格。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel (在 Microsoft.Office.Tools.Excel.dll 中)

語法

'宣告
Function SpecialCells ( _
    Type As XlCellType, _
    Value As Object _
) As Range
Range SpecialCells(
    XlCellType Type,
    Object Value
)

參數

傳回值

型別:Microsoft.Office.Interop.Excel.Range
Range ,表示所有符合指定類型和資料的儲存格。

備註

選擇性參數

如需選擇性參數的詳細資訊,請參閱Office 方案中的選擇性參數

範例

下列程式碼範例使用 SpecialCells 方法,取得並選取 XmlMappedRange 中包含註解的儲存格範圍。 這個程式碼範例假設目前工作表包含名為 CustomerLastNameCell 的 XmlMappedRange

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 安全性

請參閱

參考

XmlMappedRange 介面

Microsoft.Office.Tools.Excel 命名空間