XmlMappedRange.SpecialCells(XlCellType, Object) 方法

定義

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

public Microsoft.Office.Interop.Excel.Range SpecialCells (Microsoft.Office.Interop.Excel.XlCellType Type, object Value);
abstract member SpecialCells : Microsoft.Office.Interop.Excel.XlCellType * obj -> Microsoft.Office.Interop.Excel.Range
Public Function SpecialCells (Type As XlCellType, Optional Value As Object) As Range

參數

Type
XlCellType

要包含的儲存格。可以是下列 XlCellType 其中一個值: xlCellTypeAllFormatConditions。 任何格式的儲存格。 xlCellTypeAllValidation. 包含驗證準則的儲存格。 xlCellTypeBlanks. 空白儲存格。 xlCellTypeComments. 包含備註的儲存格。 xlCellTypeConstants. 包含常數的儲存格。 xlCellTypeFormulas. 包含公式的儲存格。 xlCellTypeLastCell. 使用範圍內的最後一個儲存格。 xlCellTypeSameFormatConditions. 包含相同格式的儲存格。 xlCellTypeSameValidation. 包含相同驗證準則的儲存格。 xlCellTypeVisible. 所有可見的儲存格。

Value
Object

如果 TypexlCellTypeConstantsxlCellTypeFormulas,則會使用此自變數來判斷要包含在結果中的單元格類型。 這些值會一起加入,以傳回多個類型。 預設是選取所有常數或公式,無論類型為何。 可以是下列 XlSpecialCellsValue 其中一個值: xlErrorsxlLogicalxlNumbersxlTextValues

傳回

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

範例

下列程式代碼範例會 SpecialCells 使用 方法來取得並選取包含 內 XmlMappedRange批注的儲存格範圍。 這個程式代碼範例假設目前的工作表包含 XmlMappedRange 名為 CustomerLastNameCell的 。

private void SelectRangeWithComments()
{
    this.CustomerLastNameCell.AddComment("This cell contains " +
        "a last name.");

    Excel.Range range1 = this.CustomerLastNameCell.SpecialCells(
        Excel.XlCellType.xlCellTypeComments);
    range1.Select();
}
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

備註

選擇性參數

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

適用於