共用方式為


Application.SelectCellDown 方法 (Project)

會從目前的選取範圍下方直接選取儲存格。

語法

expression. SelectCellDown( _NumCells_, _Extend_ )

expression 代表 Application 物件的變數。

參數

名稱 必要/選用 資料類型 描述
NumCells 選用 Long 要從目前的選取範圍向下選取的儲存格數目。 預設值為 1。
Extend 選用 Boolean True 是表示 如果目前的選取範圍會延伸至指定的儲存格。 預設值為 False

傳回值

布林值

註解

當行事曆、 網狀圖或資源圖表為使用中檢視是 SelectCellDown 方法。

範例

下面範例適用於完整 」 或 「 不完整的資源群組的資源工作表檢視中,然後選取每一列中的第一個儲存格會使用 SelectCellDown 並測試是否列是不是群組摘要。 程序會繼續直到列是空的然後顯示含有每個資料列之測試結果的訊息方塊。

Sub ShowGroupByItems() 
 Dim isValid As Boolean 
 Dim res As Resource 
 Dim rowType As String 
 Dim msg As String 
 
 isValid = True 
 msg = "" 
 
 ActiveProject.Views("Resource Sheet").Apply 
 GroupApply Name:="Complete and Incomplete Resources" 
 Application.SelectBeginning 
 
 ' When a cell in an empty row is selected, accessing the ActiveCell.Resource 
 ' property results in error 1004. 
 On Error Resume Next 
 
 ' Loop until a cell in an empty row is selected. 
 While isValid 
 Set res = ActiveCell.Resource 
 
 If Err.Number > 0 Then 
 isValid = False 
 Debug.Print Err.Number 
 Err.Number = 0 
 Else 
 If res.GroupBySummary Then 
 rowType = "' is a group-by summary row." 
 Else 
 rowType = "' is a resource row." 
 End If 
 
 msg = msg & "Resource name: '" & res.Name & rowType & vbCrLf 
 SelectCellDown 
 End If 
 Wend 
 
 MsgBox msg, vbInformation, "GroupBy Summary for Resources" 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應