View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Paul Black[_2_] Paul Black[_2_] is offline
external usenet poster
 
Posts: 112
Default Help with Totalling Groups Please

Thanks Tom,

That has Made it Clearer.
So Basically, if rng was say D5 :-
rng(1,1) would be D5
rng(1,0) would be C5 &
rng(1,-1) would be B5.
I am Still Unclear though what the "+ i" in rng(2 + i, 1) & the "+ 1" in
rng(2 + 1, 1) Actually Does.
Also, what Does the ? Do Please.

Thanks in Advance.
All the Best.
Paul



Help with Totalling Groups Please
From: Tom Ogilvy

rng is a reference to a cell.

It is set in this line:

Set rng = ActiveCell.Offset(1, 2)


this is where your first grand total is placed, but what is in the cell
is
of no significance to the rest of the code. rng is used as a referenance
from which to base the location of other information.

rng(2 + i,1)

says to go down two rows below the cell refered to by rng.

so if rng was A1

set rng = Range("A1")
i = 1
? rng(2 + i,1).Address
$A$3

A1 is rng(1,1)
A2 is rng(2,1)
A3 is rng(3,1)

B3 is rng(3,2)

so it is similar to offset, but 1 based, where offset is zero based.

rng(1,1) is the same as rng.offset(0,0)

--
Regards,
Tom Ogilvy



*** Sent via Developersdex http://www.developersdex.com ***