[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

T. Valko

12/18/2006 5:05:00 AM

Hi folks!

Application.Goto Reference:="INDIRECT(R1C1)"

Why won't that accept an A1 reference?

Both of these fail:

Application.Goto Reference:="INDIRECT(A1)"
Application.Goto Reference:="INDIRECT("A1")"

Thanks
Biff


6 Answers

T. Valko

12/18/2006 7:49:00 AM

0

Martin,

I tried this:

Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))

I get a run-time error 1004

Let me further explain:

A1 contains a defined name like Product1. Product1 refers to cell A100. I
have the macro attached to a button. I click the button and are taken to
Product1 (cell A100).

It works just fine using the R1C1 reference but I'm trying to simplify it
for others who may be confused seeing R1C1.

P.S.: the line of code I posted was generated by the macro recorder.
>>Application.Goto Reference:="INDIRECT(R1C1)"

Thanks
Biff

"Martin Fishlock" <martin_fishlock@yahoo.co.uk.cutthis> wrote in message
news:390A509A-52B6-4506-8244-82FED2CB6F1F@microsoft.com...
> Biff,
>
> Goto requires a range object. There you need to do the following:
>
> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Cells(1, 1))
>
> 'or
>
> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
>
> But it may be easier just to do thew following:
>
> range(ActiveSheet.Range("A1")).select
>
> --
> Hope this helps
> Martin Fishlock
> Please do not forget to rate this reply.
>
>
> "T. Valko" wrote:
>
>> Hi folks!
>>
>> Application.Goto Reference:="INDIRECT(R1C1)"
>>
>> Why won't that accept an A1 reference?
>>
>> Both of these fail:
>>
>> Application.Goto Reference:="INDIRECT(A1)"
>> Application.Goto Reference:="INDIRECT("A1")"
>>
>> Thanks
>> Biff
>>
>>
>>


T. Valko

12/18/2006 7:58:00 AM

0

ooops!

Disregard the last post.

It does in fact work just fine.

Thanks, Martin!

Biff

"T. Valko" <biffinpitt@comcast.net> wrote in message
news:%23KhFJknIHHA.1044@TK2MSFTNGP02.phx.gbl...
> Martin,
>
> I tried this:
>
> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
>
> I get a run-time error 1004
>
> Let me further explain:
>
> A1 contains a defined name like Product1. Product1 refers to cell A100. I
> have the macro attached to a button. I click the button and are taken to
> Product1 (cell A100).
>
> It works just fine using the R1C1 reference but I'm trying to simplify it
> for others who may be confused seeing R1C1.
>
> P.S.: the line of code I posted was generated by the macro recorder.
>>>Application.Goto Reference:="INDIRECT(R1C1)"
>
> Thanks
> Biff
>
> "Martin Fishlock" <martin_fishlock@yahoo.co.uk.cutthis> wrote in message
> news:390A509A-52B6-4506-8244-82FED2CB6F1F@microsoft.com...
>> Biff,
>>
>> Goto requires a range object. There you need to do the following:
>>
>> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Cells(1, 1))
>>
>> 'or
>>
>> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
>>
>> But it may be easier just to do thew following:
>>
>> range(ActiveSheet.Range("A1")).select
>>
>> --
>> Hope this helps
>> Martin Fishlock
>> Please do not forget to rate this reply.
>>
>>
>> "T. Valko" wrote:
>>
>>> Hi folks!
>>>
>>> Application.Goto Reference:="INDIRECT(R1C1)"
>>>
>>> Why won't that accept an A1 reference?
>>>
>>> Both of these fail:
>>>
>>> Application.Goto Reference:="INDIRECT(A1)"
>>> Application.Goto Reference:="INDIRECT("A1")"
>>>
>>> Thanks
>>> Biff
>>>
>>>
>>>
>
>


PapaDos

12/18/2006 9:53:00 AM

0

No need to create "range of range"

Application.Goto Reference:=activesheet.cells(1,1)

or

Application.Goto Reference:=activesheet.range("a1")

should work just fine...

--
Regards,
Luc.

"Festina Lente"


"T. Valko" wrote:

> ooops!
>
> Disregard the last post.
>
> It does in fact work just fine.
>
> Thanks, Martin!
>
> Biff
>
> "T. Valko" <biffinpitt@comcast.net> wrote in message
> news:%23KhFJknIHHA.1044@TK2MSFTNGP02.phx.gbl...
> > Martin,
> >
> > I tried this:
> >
> > Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
> >
> > I get a run-time error 1004
> >
> > Let me further explain:
> >
> > A1 contains a defined name like Product1. Product1 refers to cell A100. I
> > have the macro attached to a button. I click the button and are taken to
> > Product1 (cell A100).
> >
> > It works just fine using the R1C1 reference but I'm trying to simplify it
> > for others who may be confused seeing R1C1.
> >
> > P.S.: the line of code I posted was generated by the macro recorder.
> >>>Application.Goto Reference:="INDIRECT(R1C1)"
> >
> > Thanks
> > Biff
> >
> > "Martin Fishlock" <martin_fishlock@yahoo.co.uk.cutthis> wrote in message
> > news:390A509A-52B6-4506-8244-82FED2CB6F1F@microsoft.com...
> >> Biff,
> >>
> >> Goto requires a range object. There you need to do the following:
> >>
> >> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Cells(1, 1))
> >>
> >> 'or
> >>
> >> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
> >>
> >> But it may be easier just to do thew following:
> >>
> >> range(ActiveSheet.Range("A1")).select
> >>
> >> --
> >> Hope this helps
> >> Martin Fishlock
> >> Please do not forget to rate this reply.
> >>
> >>
> >> "T. Valko" wrote:
> >>
> >>> Hi folks!
> >>>
> >>> Application.Goto Reference:="INDIRECT(R1C1)"
> >>>
> >>> Why won't that accept an A1 reference?
> >>>
> >>> Both of these fail:
> >>>
> >>> Application.Goto Reference:="INDIRECT(A1)"
> >>> Application.Goto Reference:="INDIRECT("A1")"
> >>>
> >>> Thanks
> >>> Biff
> >>>
> >>>
> >>>
> >
> >
>
>
>

T. Valko

12/18/2006 11:13:00 PM

0

>Application.Goto Reference:=activesheet.range("a1")

That doesn't work. It just selects cell A1.

Biff

"PapaDos" <PapaDos@discussions.microsoft.com> wrote in message
news:E49E3912-B175-4603-869D-1B0EA9376868@microsoft.com...
> No need to create "range of range"
>
> Application.Goto Reference:=activesheet.cells(1,1)
>
> or
>
> Application.Goto Reference:=activesheet.range("a1")
>
> should work just fine...
>
> --
> Regards,
> Luc.
>
> "Festina Lente"
>
>
> "T. Valko" wrote:
>
>> ooops!
>>
>> Disregard the last post.
>>
>> It does in fact work just fine.
>>
>> Thanks, Martin!
>>
>> Biff
>>
>> "T. Valko" <biffinpitt@comcast.net> wrote in message
>> news:%23KhFJknIHHA.1044@TK2MSFTNGP02.phx.gbl...
>> > Martin,
>> >
>> > I tried this:
>> >
>> > Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
>> >
>> > I get a run-time error 1004
>> >
>> > Let me further explain:
>> >
>> > A1 contains a defined name like Product1. Product1 refers to cell A100.
>> > I
>> > have the macro attached to a button. I click the button and are taken
>> > to
>> > Product1 (cell A100).
>> >
>> > It works just fine using the R1C1 reference but I'm trying to simplify
>> > it
>> > for others who may be confused seeing R1C1.
>> >
>> > P.S.: the line of code I posted was generated by the macro recorder.
>> >>>Application.Goto Reference:="INDIRECT(R1C1)"
>> >
>> > Thanks
>> > Biff
>> >
>> > "Martin Fishlock" <martin_fishlock@yahoo.co.uk.cutthis> wrote in
>> > message
>> > news:390A509A-52B6-4506-8244-82FED2CB6F1F@microsoft.com...
>> >> Biff,
>> >>
>> >> Goto requires a range object. There you need to do the following:
>> >>
>> >> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Cells(1, 1))
>> >>
>> >> 'or
>> >>
>> >> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
>> >>
>> >> But it may be easier just to do thew following:
>> >>
>> >> range(ActiveSheet.Range("A1")).select
>> >>
>> >> --
>> >> Hope this helps
>> >> Martin Fishlock
>> >> Please do not forget to rate this reply.
>> >>
>> >>
>> >> "T. Valko" wrote:
>> >>
>> >>> Hi folks!
>> >>>
>> >>> Application.Goto Reference:="INDIRECT(R1C1)"
>> >>>
>> >>> Why won't that accept an A1 reference?
>> >>>
>> >>> Both of these fail:
>> >>>
>> >>> Application.Goto Reference:="INDIRECT(A1)"
>> >>> Application.Goto Reference:="INDIRECT("A1")"
>> >>>
>> >>> Thanks
>> >>> Biff
>> >>>
>> >>>
>> >>>
>> >
>> >
>>
>>
>>


PapaDos

12/19/2006 3:09:00 PM

0

LOL

Sorry, I misunderstood your need.

The fact that "INDIRECT(R1C1)" does work is a major surprise for me !
Then, a construct like this one would work too:

Application.Goto Reference:="indirect(" & range("a1").address(,,xlR1C1) & ")"


--
Regards,
Luc.

"Festina Lente"


"T. Valko" wrote:

> >Application.Goto Reference:=activesheet.range("a1")
>
> That doesn't work. It just selects cell A1.
>
> Biff
>
> "PapaDos" <PapaDos@discussions.microsoft.com> wrote in message
> news:E49E3912-B175-4603-869D-1B0EA9376868@microsoft.com...
> > No need to create "range of range"
> >
> > Application.Goto Reference:=activesheet.cells(1,1)
> >
> > or
> >
> > Application.Goto Reference:=activesheet.range("a1")
> >
> > should work just fine...
> >
> > --
> > Regards,
> > Luc.
> >
> > "Festina Lente"
> >
> >
> > "T. Valko" wrote:
> >
> >> ooops!
> >>
> >> Disregard the last post.
> >>
> >> It does in fact work just fine.
> >>
> >> Thanks, Martin!
> >>
> >> Biff
> >>
> >> "T. Valko" <biffinpitt@comcast.net> wrote in message
> >> news:%23KhFJknIHHA.1044@TK2MSFTNGP02.phx.gbl...
> >> > Martin,
> >> >
> >> > I tried this:
> >> >
> >> > Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
> >> >
> >> > I get a run-time error 1004
> >> >
> >> > Let me further explain:
> >> >
> >> > A1 contains a defined name like Product1. Product1 refers to cell A100.
> >> > I
> >> > have the macro attached to a button. I click the button and are taken
> >> > to
> >> > Product1 (cell A100).
> >> >
> >> > It works just fine using the R1C1 reference but I'm trying to simplify
> >> > it
> >> > for others who may be confused seeing R1C1.
> >> >
> >> > P.S.: the line of code I posted was generated by the macro recorder.
> >> >>>Application.Goto Reference:="INDIRECT(R1C1)"
> >> >
> >> > Thanks
> >> > Biff
> >> >
> >> > "Martin Fishlock" <martin_fishlock@yahoo.co.uk.cutthis> wrote in
> >> > message
> >> > news:390A509A-52B6-4506-8244-82FED2CB6F1F@microsoft.com...
> >> >> Biff,
> >> >>
> >> >> Goto requires a range object. There you need to do the following:
> >> >>
> >> >> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Cells(1, 1))
> >> >>
> >> >> 'or
> >> >>
> >> >> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
> >> >>
> >> >> But it may be easier just to do thew following:
> >> >>
> >> >> range(ActiveSheet.Range("A1")).select
> >> >>
> >> >> --
> >> >> Hope this helps
> >> >> Martin Fishlock
> >> >> Please do not forget to rate this reply.
> >> >>
> >> >>
> >> >> "T. Valko" wrote:
> >> >>
> >> >>> Hi folks!
> >> >>>
> >> >>> Application.Goto Reference:="INDIRECT(R1C1)"
> >> >>>
> >> >>> Why won't that accept an A1 reference?
> >> >>>
> >> >>> Both of these fail:
> >> >>>
> >> >>> Application.Goto Reference:="INDIRECT(A1)"
> >> >>> Application.Goto Reference:="INDIRECT("A1")"
> >> >>>
> >> >>> Thanks
> >> >>> Biff
> >> >>>
> >> >>>
> >> >>>
> >> >
> >> >
> >>
> >>
> >>
>
>
>

T. Valko

12/20/2006 6:13:00 AM

0

Ok, that works!

Thanks

Biff

"PapaDos" <PapaDos@discussions.microsoft.com> wrote in message
news:0D1E6FC0-B6C8-4E04-8535-4EA7D49264FB@microsoft.com...
> LOL
>
> Sorry, I misunderstood your need.
>
> The fact that "INDIRECT(R1C1)" does work is a major surprise for me !
> Then, a construct like this one would work too:
>
> Application.Goto Reference:="indirect(" & range("a1").address(,,xlR1C1) &
> ")"
>
>
> --
> Regards,
> Luc.
>
> "Festina Lente"
>
>
> "T. Valko" wrote:
>
>> >Application.Goto Reference:=activesheet.range("a1")
>>
>> That doesn't work. It just selects cell A1.
>>
>> Biff
>>
>> "PapaDos" <PapaDos@discussions.microsoft.com> wrote in message
>> news:E49E3912-B175-4603-869D-1B0EA9376868@microsoft.com...
>> > No need to create "range of range"
>> >
>> > Application.Goto Reference:=activesheet.cells(1,1)
>> >
>> > or
>> >
>> > Application.Goto Reference:=activesheet.range("a1")
>> >
>> > should work just fine...
>> >
>> > --
>> > Regards,
>> > Luc.
>> >
>> > "Festina Lente"
>> >
>> >
>> > "T. Valko" wrote:
>> >
>> >> ooops!
>> >>
>> >> Disregard the last post.
>> >>
>> >> It does in fact work just fine.
>> >>
>> >> Thanks, Martin!
>> >>
>> >> Biff
>> >>
>> >> "T. Valko" <biffinpitt@comcast.net> wrote in message
>> >> news:%23KhFJknIHHA.1044@TK2MSFTNGP02.phx.gbl...
>> >> > Martin,
>> >> >
>> >> > I tried this:
>> >> >
>> >> > Application.Goto
>> >> > Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
>> >> >
>> >> > I get a run-time error 1004
>> >> >
>> >> > Let me further explain:
>> >> >
>> >> > A1 contains a defined name like Product1. Product1 refers to cell
>> >> > A100.
>> >> > I
>> >> > have the macro attached to a button. I click the button and are
>> >> > taken
>> >> > to
>> >> > Product1 (cell A100).
>> >> >
>> >> > It works just fine using the R1C1 reference but I'm trying to
>> >> > simplify
>> >> > it
>> >> > for others who may be confused seeing R1C1.
>> >> >
>> >> > P.S.: the line of code I posted was generated by the macro recorder.
>> >> >>>Application.Goto Reference:="INDIRECT(R1C1)"
>> >> >
>> >> > Thanks
>> >> > Biff
>> >> >
>> >> > "Martin Fishlock" <martin_fishlock@yahoo.co.uk.cutthis> wrote in
>> >> > message
>> >> > news:390A509A-52B6-4506-8244-82FED2CB6F1F@microsoft.com...
>> >> >> Biff,
>> >> >>
>> >> >> Goto requires a range object. There you need to do the following:
>> >> >>
>> >> >> Application.Goto Reference:=ActiveSheet.Range(ActiveSheet.Cells(1,
>> >> >> 1))
>> >> >>
>> >> >> 'or
>> >> >>
>> >> >> Application.Goto
>> >> >> Reference:=ActiveSheet.Range(ActiveSheet.Range("A1"))
>> >> >>
>> >> >> But it may be easier just to do thew following:
>> >> >>
>> >> >> range(ActiveSheet.Range("A1")).select
>> >> >>
>> >> >> --
>> >> >> Hope this helps
>> >> >> Martin Fishlock
>> >> >> Please do not forget to rate this reply.
>> >> >>
>> >> >>
>> >> >> "T. Valko" wrote:
>> >> >>
>> >> >>> Hi folks!
>> >> >>>
>> >> >>> Application.Goto Reference:="INDIRECT(R1C1)"
>> >> >>>
>> >> >>> Why won't that accept an A1 reference?
>> >> >>>
>> >> >>> Both of these fail:
>> >> >>>
>> >> >>> Application.Goto Reference:="INDIRECT(A1)"
>> >> >>> Application.Goto Reference:="INDIRECT("A1")"
>> >> >>>
>> >> >>> Thanks
>> >> >>> Biff
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>