View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Super Slueth Super Slueth is offline
external usenet poster
 
Posts: 5
Default Variable in cell reference

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