_Application.Goto Method

Selects any range or Visual Basic procedure in any workbook and activates that workbook if it’s not already active.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Sub Goto ( _
    Reference As Object, _
    Scroll As Object _
)
'Usage
Dim instance As _Application
Dim Reference As Object
Dim Scroll As Object

instance.Goto(Reference, Scroll)
void Goto(
    Object Reference,
    Object Scroll
)

Parameters

  • Reference
    Type: System.Object

    Optional Object. The destination. Can be a Range object, a string that contains a cell reference in R1C1-style notation, or a string that contains a Visual Basic procedure name. If this argument is omitted, the destination is the last range you used the Goto method to select.

  • Scroll
    Type: System.Object

    Optional Object. True to scroll through the window so that the upper-left corner of the range appears in the upper-left corner of the window. False to not scroll through the window. The default is False.

Remarks

This method differs from the Select method in the following ways:

  • If you specify a range on a sheet that’s not on top, Microsoft Excel will switch to that sheet before selecting. (If you use Select with a range on a sheet that’s not on top, the range will be selected but the sheet won’t be activated).

  • This method has a Scroll argument that lets you scroll through the destination window.

  • When you use the Goto method, the previous selection (before the Goto method runs) is added to the array of previous selections (for more information, see the PreviousSelections property). You can use this feature to quickly jump between as many as four selections.

  • The Select method has a Replace argument; the Goto method doesn’t.

See Also

Reference

_Application Interface

_Application Members

Microsoft.Office.Interop.Excel Namespace