Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I'm using the following code to sum a cell range I want to use variablles but it's not working strEndCell = ActiveCell.SpecialCells(xlLastCell).Address strEndCell = Mid(strEndCell, 4) j = Val(strEndCell) j = j + 2 str1 = "H" & j j = j - 2 Range(str1).Select ActiveCell.FormulaR1C1 = "=SUM(R[-j]C:R[-1]C)" What I'm trying to do is find the last cell in a sheet then go 2 cells below that and SUM a column I the SUM formula I'm using "j" as a varable to point to a cell I'm not sure if I'm going about it in the right manner Any suggestions please Many thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim cell As Range
Set cell = ActiveCell.SpecialCells(xlLastCell) cell.offset(2, 0).FormulaR1C1 = "=SUM(R1C:R[-1]C)" -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Super Slueth" wrote in message ... Hello I'm using the following code to sum a cell range I want to use variablles but it's not working strEndCell = ActiveCell.SpecialCells(xlLastCell).Address strEndCell = Mid(strEndCell, 4) j = Val(strEndCell) j = j + 2 str1 = "H" & j j = j - 2 Range(str1).Select ActiveCell.FormulaR1C1 = "=SUM(R[-j]C:R[-1]C)" What I'm trying to do is find the last cell in a sheet then go 2 cells below that and SUM a column I the SUM formula I'm using "j" as a varable to point to a cell I'm not sure if I'm going about it in the right manner Any suggestions please Many thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Variable Cell Reference | Excel Discussion (Misc queries) | |||
Variable Cell Reference | Excel Worksheet Functions | |||
How do I use a variable in a cell reference? | 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 |