Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Indirect function - relative reference

Hi,

I struggle to create a macro with INDIRECT function that would jump to
different cells. What cell I want to jump to depends on a currently selected
cell. This means I need to put a relative reference into the function.

Here is my function - I need to replace R1C1 expression with a realtive one
(currently selected cell address with the same behavior as R1C1 expression).
How can I do that?

Application.Goto Reference:= _

"INDIRECT(CONCATENATE(R56C8,""!"",""a"",MATCH(R56C 1,INDIRECT(CONCATENATE(R56
C8,1)),false)))"

Whatever I do I get following error mesage:
Run-time error '1004'

Thanks in advance
Vladimir



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Indirect function - relative reference

Dim rng as Range
set rng = Range(Range("H56") & "!A" & Application.Match( _
Range("A56"),Range(Range("H56") & "!A1").EntireRow,0))
Applicaton.GoTo Reference:=rng

If H56 on the Active sheet holds sheet2
and Sheet 2 row1 has the numbers 1 to 20 in columns A to T

and A56 on the activesheet holds the number 10, then this goes to
Sheet2!A10

--
Regards,
Tom Ogilvy


"Vladimir" wrote in message
...
Hi,

I struggle to create a macro with INDIRECT function that would jump to
different cells. What cell I want to jump to depends on a currently

selected
cell. This means I need to put a relative reference into the function.

Here is my function - I need to replace R1C1 expression with a realtive

one
(currently selected cell address with the same behavior as R1C1

expression).
How can I do that?

Application.Goto Reference:= _


"INDIRECT(CONCATENATE(R56C8,""!"",""a"",MATCH(R56C 1,INDIRECT(CONCATENATE(R56
C8,1)),false)))"

Whatever I do I get following error mesage:
Run-time error '1004'

Thanks in advance
Vladimir





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Indirect function - relative reference

Thanks, but I might badly express myself.

What I need is to persuade the macro to read the current position of the
active cell.
So, if the active cell will be B2 the expression would be:
Application.Goto Reference:= _

"INDIRECT(CONCATENATE(R2C2,""!"",""a"",MATCH(R2C1, INDIRECT(CONCATENATE(R2C2,
1)),0)))"

if the active cell will be B10 the expression would be
Application.Goto Reference:= _

"INDIRECT(CONCATENATE(R10C2,""!"",""a"",MATCH(R10C 1,INDIRECT(CONCATENATE(R10
C2,1)),0)))"

What I intend to do is to double click on a cell - trigger a macro that will
read its contents (range name) and in this range find a value from the 1st
column on the same row of the active cell and jump on a cell in this range
that contains this value.

How can I manage that?

Thanks Vladimir

"Tom Ogilvy" píše v diskusním příspěvku
...
Dim rng as Range
set rng = Range(Range("H56") & "!A" & Application.Match( _
Range("A56"),Range(Range("H56") & "!A1").EntireRow,0))
Applicaton.GoTo Reference:=rng

If H56 on the Active sheet holds sheet2
and Sheet 2 row1 has the numbers 1 to 20 in columns A to T

and A56 on the activesheet holds the number 10, then this goes to
Sheet2!A10

--
Regards,
Tom Ogilvy


"Vladimir" wrote in message
...
Hi,

I struggle to create a macro with INDIRECT function that would jump to
different cells. What cell I want to jump to depends on a currently

selected
cell. This means I need to put a relative reference into the function.

Here is my function - I need to replace R1C1 expression with a realtive

one
(currently selected cell address with the same behavior as R1C1

expression).
How can I do that?

Application.Goto Reference:= _



"INDIRECT(CONCATENATE(R56C8,""!"",""a"",MATCH(R56C 1,INDIRECT(CONCATENATE(R56
C8,1)),false)))"

Whatever I do I get following error mesage:
Run-time error '1004'

Thanks in advance
Vladimir







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Indirect function - relative reference

set rng = Range(ActiveCell & "!A" & Application.Match( _
Cells(ActiveCell.row,1),Range(ActiveCell & "!A1").EntireRow,0))
Applicaton.GoTo Reference:=rng

--
Regards,
Tom Ogilvy

"Vladimir" wrote in message
...
Thanks, but I might badly express myself.

What I need is to persuade the macro to read the current position of the
active cell.
So, if the active cell will be B2 the expression would be:
Application.Goto Reference:= _


"INDIRECT(CONCATENATE(R2C2,""!"",""a"",MATCH(R2C1, INDIRECT(CONCATENATE(R2C2,
1)),0)))"

if the active cell will be B10 the expression would be
Application.Goto Reference:= _


"INDIRECT(CONCATENATE(R10C2,""!"",""a"",MATCH(R10C 1,INDIRECT(CONCATENATE(R10
C2,1)),0)))"

What I intend to do is to double click on a cell - trigger a macro that

will
read its contents (range name) and in this range find a value from the 1st
column on the same row of the active cell and jump on a cell in this range
that contains this value.

How can I manage that?

Thanks Vladimir

"Tom Ogilvy" píše v diskusním příspěvku
...
Dim rng as Range
set rng = Range(Range("H56") & "!A" & Application.Match( _
Range("A56"),Range(Range("H56") & "!A1").EntireRow,0))
Applicaton.GoTo Reference:=rng

If H56 on the Active sheet holds sheet2
and Sheet 2 row1 has the numbers 1 to 20 in columns A to T

and A56 on the activesheet holds the number 10, then this goes to
Sheet2!A10

--
Regards,
Tom Ogilvy


"Vladimir" wrote in message
...
Hi,

I struggle to create a macro with INDIRECT function that would jump to
different cells. What cell I want to jump to depends on a currently

selected
cell. This means I need to put a relative reference into the function.

Here is my function - I need to replace R1C1 expression with a

realtive
one
(currently selected cell address with the same behavior as R1C1

expression).
How can I do that?

Application.Goto Reference:= _




"INDIRECT(CONCATENATE(R56C8,""!"",""a"",MATCH(R56C 1,INDIRECT(CONCATENATE(R56
C8,1)),false)))"

Whatever I do I get following error mesage:
Run-time error '1004'

Thanks in advance
Vladimir









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Indirect function €“ relative column copy/paste Gary T Excel Worksheet Functions 1 September 24th 08 02:52 PM
Cell reference OR INDIRECT function Excel ESG Excel Worksheet Functions 2 June 11th 07 11:26 AM
indirect function within sumif to reference other sheets [email protected] Excel Worksheet Functions 3 June 15th 06 05:46 PM
Trying to use the INDIRECT funtion with a relative Row reference Paul Cahoon Excel Discussion (Misc queries) 1 December 29th 05 08:03 AM
indirect function to reference cell on different sheet Dolemite Excel Worksheet Functions 2 August 19th 05 05:25 PM


All times are GMT +1. The time now is 02:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright Š2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"