#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA coding

Why do the cell references in part of the macro below
include negative numbers?


ActiveCell.FormulaR1C1 = "=RC[-2]-RC[-3]"
Range("C5").Select
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA coding

The cells are reference as R1, C1 - It's like offset from the activecell.

ActiveCell.FormulaR1C1 = "=RC[-2]-RC[-3]"

This could also be interpreted as this

ActiveCell.Formula = "=B2+B3"

If you want to see this type of refernce on your worksheet, goto menu bar

TOOLS Options

Click the General tab, you will see the R1C1 reference style.

This type is useful, when you want to calculate / move to cells based on
your current location.

Hope this helps

Hari

"Eléna" wrote in message
...
Why do the cell references in part of the macro below
include negative numbers?


ActiveCell.FormulaR1C1 = "=RC[-2]-RC[-3]"
Range("C5").Select



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.746 / Virus Database: 498 - Release Date: 31/08/2004


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA coding

The interpretation would depend on what cell the formula is place in, but
since the rows are absolute and the columns relative, I don't know of any
cell where it would be interpreted as =B2+B3, particularly since the formula
does subtraction rather than addition

ActiveCell.FormulaR1C1 = "=RC[-2]-RC[-3]"

if the activeCell is D5 would be equivalent to =B5-A5

--
Regards,
Tom Ogilvy

"Harry" wrote in message
...
The cells are reference as R1, C1 - It's like offset from the activecell.

ActiveCell.FormulaR1C1 = "=RC[-2]-RC[-3]"

This could also be interpreted as this

ActiveCell.Formula = "=B2+B3"

If you want to see this type of refernce on your worksheet, goto menu bar

TOOLS Options

Click the General tab, you will see the R1C1 reference style.

This type is useful, when you want to calculate / move to cells based on
your current location.

Hope this helps

Hari

"Eléna" wrote in message
...
Why do the cell references in part of the macro below
include negative numbers?


ActiveCell.FormulaR1C1 = "=RC[-2]-RC[-3]"
Range("C5").Select



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.746 / Virus Database: 498 - Release Date: 31/08/2004




  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default VBA coding

hi
In the example below, R stands for Row and C stands for
column.
Positive number For R mean down negative number mean up.
Positive number for c mean left negative number mean right
so RC[-2] means zero rows up/down and 2 columns to left.
if R[1]C[2] then
one row down and 2 column right.

-----Original Message-----
Why do the cell references in part of the macro below
include negative numbers?


ActiveCell.FormulaR1C1 = "=RC[-2]-RC[-3]"
Range("C5").Select
.

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
sum by coding without 0 kaja New Users to Excel 1 March 2nd 08 09:09 PM
sum by coding [email protected] New Users to Excel 1 February 27th 08 01:12 PM
coding maisy1 Excel Discussion (Misc queries) 1 August 6th 06 08:58 PM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan[_3_] Excel Programming 10 October 6th 05 01:18 PM
Coding Tom Ogilvy Excel Programming 0 September 9th 04 01:44 PM


All times are GMT +1. The time now is 05:51 AM.

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

About Us

"It's about Microsoft Excel"