SetActiveCell Method

Sets the value of the active cell.

Syntax

expression**.SetActiveCell(Value, Create)**

*expression   *     Optional. An expression that returns an Application object.

Value    Required String. The new value for the active cell.

Create    Optional Boolean. True if a new assignment, resource, or task should be created when setting the value of the active cell, if one doesn't already exist. The default value is True.

Remarks

The SetActiveCell method is not available when the Calendar, Network Diagram, or Resource Graph is the active view.

Example

The following example enters the specified text in the active cell. It assumes the active cell accepts string input.

Sub AddCommentToTable()

    Dim M As String
    
    M = InputBox$("Enter your comment: ")
    SetActiveCell M, False
    
End Sub

Applies to | Application Object