Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with cell reference
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 *** |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with cell reference
Sub test()
Dim a As Long Dim isum As Double a = 20 isum = Application.WorksheetFunction.sum(Range( _ Cells(1, "A"), _ Cells(a, "A") _ )) MsgBox isum End Sub HTH -- AP "Harjinder Singh" a écrit dans le message de ... 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 *** |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with cell reference
dim a as long a=20 "=SUM(RC1:RC" & a & ")" this will sum column 1 to column 20 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 som 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 ** -- kwiklearne ----------------------------------------------------------------------- kwiklearner's Profile: http://www.excelforum.com/member.php...fo&userid=3190 View this thread: http://www.excelforum.com/showthread.php?threadid=52306 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing sheet reference to cell reference | Excel Worksheet Functions | |||
Formulas that reference cells that reference another cell | Excel Discussion (Misc queries) | |||
absolute cell reference A spreadsheet cell reference that does no | Excel Discussion (Misc queries) | |||
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. | Excel Worksheet Functions | |||
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable | Excel Worksheet Functions |