Get Cell Action Icon

Get Active Cell

Declaration

<AMEXCELGETACTIVECELL SESSION="text" ACTION="text(options)" UPPERLEFTROWVARIABLE="text" UPPERLEFTCOLUMNVARIABLE="text" LOWERRIGHTROWVARIABLE="text" LOWERRIGHTCOLUMNVARIABLE="text" />

See Also

Activate Cell | Activate Worksheet | Add Worksheet | Cells to Dataset | Close Workbook | Create Workbook | Dataset to Cells Action | Get Active Cell | Get Active Worksheet | Get Cell | Open Workbook | Set Cell

Description

Retrieves the position of the currently active cell or range of cells in an established Excel session and populates one or more variables with the cell reference or position coordinates. Use the Activate Cell action to activate a cell or range of cells in an established worksheet.

IMPORTANT: AutoMate's Excel actions use Microsoft's Excel automation engine to perform their work. Therefore, Microsoft Excel must be licensed and installed on the system in order for these actions to work.

Practical Usage

Used to get the currently active cell or range of cells associated with the active worksheet in a Microsoft Excel document that was previously created using the Create Workbook action or opened using the Open Workbook action.

NOTE: This action is only useful in conjunction with other Excel actions found in AutoMate. It is not possible to use Automate's Excel actions on a spreadsheet that was not opened by the Open Workbook action or created by the Create Workbook action.

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Session Name

Text

Yes

ExcelSess1

SESSION="ExcelSess7"

The name of the session to associate with this Excel action. Numerous sessions can exist within a single task allowing several spreadsheets to be open simultaneously. If working with only one document, this can remain at the default session name, which is Excelsess1.

Get Active

Text (options)

Yes

Cell by Reference

ACTION="rangebyposition"

Specifies the method in which this action retrieves the active cell or range of cells. The available options are:

  • Cell by reference (Default) - Returns a single cell using a reference such as A1 or B3. If more than one cell is active, this action returns the upper left cell.

  • Cell by position - Returns row and column positions for a single cell. If more than one cell is active, this action returns the upper left cell.

  • Range of cells by reference - Returns a range of cells using the reference designations for the upper left and lower right cells in the active range of cells.

  • Range of cells by position - Returns the row and column positions of the upper left and lower right cells in the active range of cells.

Populate Variable with Cell Reference

Text

No

(Empty)

CELLREFVARIABLE="refVar"

The name of the variable to populate with the cell reference. Active only if Cell by reference is the selected Activate parameter.  

Populate Variable With Row

Number

No

(Empty)

CELLROWVARIABLE="rowVar"

The variable to populate with the cell row. Active only if Cell by position is the selected Get Active parameter.

Populate Variable With Column

Number

No

(Empty)

 

CELLCOLUMNVARIABLE=

"columnVar"

The variable to populate with the cell column. Active only if Cell by position is the selected Get Active parameter.

Populate Variable With Upper Left Cell

Text

No

(Empty)

 

UPPERLEFTREFVARIABLE=

"upperLeftVar"

The variable to populate with the row number of the upper left cell in the range of active cells. Active only if Range of cells by reference is the selected Get Active parameter.

Populate Variable With Lower Right Cell

Text

No

(Empty)

 

LOWERRIGHTREFVARIABLE=

"lowerRightVar"

The variable to populate with the row number of the lower right cell in the range of active cells. Active only if Range of cells by reference is the selected Get Active parameter.

Populate Variable With Upper Left Cell Row

Yes/No

No

(Empty)

 

UPPERLEFTROWVARIABLE=

"upLeftCellRow"

The variable to populate with the row number of the lower right cell in the range of active cells. Active only if Range of cells by position is the selected Get Active parameter.

Populate Variable With Upper Left Cell Column

Text

No

(Empty)

 

UPPERLEFTCOLUMNVARIABLE=

"upLeftCellColumn"

The variable to populate with the row number of the upper left cell in the range of active cells. Active only if Range of cells by position is the selected Get Active parameter.

Populate Variable With Lower Right Cell Row

Text

No

(Empty)

 

LOWERRIGHTROWVARIABLE=

"lowRightCellRow"

The variable to populate with the row number of the lower right cell in the range of active cells. Active only if Range of cells by position is the selected Activate parameter.  

Populate Variable With Lower Right Cell Column

Text

No

Sheet1

LOWERRIGHTCOLUMNVARIABLE=

"lowRightCellColumn"

The variable to populate with the column number of the lower right cell in the range of active cells. Active only if Range of cells by position is the selected Activate parameter.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: Get active cell in workbook open in session "Session 102".  Populate variable "topLeftRow" with the row of the cell in the upper left corner of the selection.  Populate variable "topLeftColumn" with the column # of the cell in the upper left corner of the selection.  Populate variable "bottomRightRow" with the row of the cell in the lower right corner of the selection.  Populate variable "bottomRightColumn" with the column # of the cell in the lower right corner of the selection.  

 

<AMEXCELGETACTIVECELL SESSION="Session 102" ACTION="rangebyposition" UPPERLEFTROWVARIABLE="topLeftRow" UPPERLEFTCOLUMNVARIABLE="topLeftColumn" LOWERRIGHTROWVARIABLE="bottomRightRow" LOWERRIGHTCOLUMNVARIABLE="bottomRightColumn" />

 

↑ Top of Page