Edytuj

Udostępnij za pośrednictwem


_Application.Goto(Object, Object) Method

Definition

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

public void Goto (object Reference, object Scroll);
Public Sub Goto (Optional Reference As Object, Optional Scroll As Object)

Parameters

Reference
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
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(Object) 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[Object] 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.

Applies to