View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Goto Worksheet with Defined Range Name

The VBA help show how to use the GOTO method
This example selects cell A154 on Sheet1 and then scrolls through the
worksheet to display the range.

Application.Goto Reference:=Worksheets("Sheet1").Range("A154"), _
scroll:=True

You can replace the range with a named range
Sub test()
Application.Goto Reference:=Application.Range("rngCopyTo"), _
scroll:=True
End Sub


"needVBAhelp" wrote:

I have a macro that defines a range name as follows:

Set rngCopyTo = Application.InputBox( _
prompt:="Select the UPPER LEFT CELL of the " _
& "range to which you wish to paste", _
Title:="Copy Range Formulae", Type:=8).Cells(1, 1)

I do not know in advance the worksheet that will ultimately contain the
range for "rngCopyTo".

Later in the macro, I want to goto "rngCopyTo".

I have tried the following, but I get an error message unless the selected
worksheet contains the range for "rngCopyTo". Is there a VBA code that will
find and select the worksheet that contains "rngCopyTo"?

rngCopyTo.Select

Thank you for any help.

--
needVBAhelp