Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Referring to a relative cell within a function

Cells(ActiveCell.Row + 0, 6).FormulaR1C1 = "=VLOOKUP(RC[-4];'Sheet2'!
A:D;3;FALSE)" doesn't work. How do you relatively refer to a cell
within a function? RC[-4] should be replaced.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Referring to a relative cell within a function

Hi,

I'm not sure I fully understand what you mean but maybe this

Cells(ActiveCell.Row + 0, 6).FormulaR1C1 =
"=VLOOKUP(RC[-4],Sheet2!R[-15]C[-6]:R[14]C[-3],3,FALSE)"

Note that I've used , instead of ; for my version of Excel so change these
back.

Mike

" wrote:

Cells(ActiveCell.Row + 0, 6).FormulaR1C1 = "=VLOOKUP(RC[-4];'Sheet2'!
A:D;3;FALSE)" doesn't work. How do you relatively refer to a cell
within a function? RC[-4] should be replaced.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Referring to a relative cell within a function

Thanks. RC[-4] did actually work, the problem wasn't there.

But why does Excel add ( and ) around L?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Referring to a relative cell within a function

Hi,

I'm pleased that worked but I don't understand what you mean by
But why does Excel add ( and ) around L?


Mike
" wrote:

Thanks. RC[-4] did actually work, the problem wasn't there.

But why does Excel add ( and ) around L?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referring to a relative cell within a function

Cells(ActiveCell.Row, 6).FormulaR1C1 = "=VLOOKUP(RC[-4],'Sheet2'!C1:C4,3,FALSE)

VBA is USA centric--use commas, not semicolons.

And 'Sheet2'!A:D wasn't in R1C1 reference style.

wrote:

Cells(ActiveCell.Row + 0, 6).FormulaR1C1 = "=VLOOKUP(RC[-4];'Sheet2'!
A:D;3;FALSE)" doesn't work. How do you relatively refer to a cell
within a function? RC[-4] should be replaced.


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Referring to a relative cell within a function


I'm pleased that worked but I don't understand what you mean by

But why does Excel add ( and ) around L?


When I go to the cell that the macro affected, the function bar shows
parentheses around the L, which indicates column.
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
Relative cell value in function Humphrey Excel Programming 8 February 1st 08 09:01 AM
Using the drag down function and formula referring to other worksh Keith Excel Discussion (Misc queries) 3 July 27th 07 01:44 AM
Referring to Cells in a forumula using a function LRL Excel Worksheet Functions 2 November 4th 05 06:35 AM
Referring to function in another workbook psp Excel Worksheet Functions 1 August 31st 05 10:32 PM
SUMIF function referring to values on different Worksheet TeeBee0831 Excel Worksheet Functions 10 May 3rd 05 10:28 PM


All times are GMT +1. The time now is 11:11 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"