View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Help with cell reference

the formula you show actually sums the 4 cells to the right of the cell
containing the formula.

You can supply a variable

a = 20
activecell.formulaR1C1 = "=Sum(RC[1]:RC[" & a & "])"

--
Regards,
Tom Ogilvy


"Harjinder Singh" wrote:



Hi,

I am trying to sum of few cell wherein i am not sure what would be the
maximum cell.

for example if i am using the below given formula it givs me the some of
cell one to cell four but i do not want the static result.
"=SUM(RC[1]:RC[4])"

will it possible if I assign a value to a variable:

like

a=20
and use the formula like this:

"=SUM(RC[1]:RC[a])"

- Harry

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