View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
needVBAhelp needVBAhelp is offline
external usenet poster
 
Posts: 11
Default Goto Worksheet with Defined Range Name

Yes, this works. I did not want to have to manually enter the worksheet name,
but that looks like the solution.

Thanks much for your help.
--
needVBAhelp


"JLGWhiz" wrote:

I think you might neet two InputBox variables to accomplish what you want to
do.
Psuedo code:
cpytoWks = InputBox("Enter Destination Worksheet Name". "Worksheet")
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)
Wks1.Range("A1:C5").Copy Sheets(cpytoWks).Range(rngCopyTo)

That gets you to the sheet and range without a GoTo.
"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