Application.SelectCellDown method (Project)
Selects cells directly below the current selection.
expression A variable that represents an Application object.
|NumCells||Optional||Long||The number of cells to select downward from the current selection. The default value is 1.|
|Extend||Optional||Boolean||True if the current selection is extended to the specified cell. The default value is False.|
The SelectCellDown method is not available when the Calendar, Network Diagram, or Resource Graph is the active view.
The following example applies the Complete and Incomplete Resources grouping to the Resource Sheet view, and then uses SelectCellDown to select the first cell in each row and tests whether the row is a group summary. The process continues until the row is empty, and then shows a message box with the test results for each row.
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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.