View Single Post
  #4   Report Post  
 
Posts: n/a
Default Referencing cell in another sheet yields null?

Wow, I didn't put my latest version of that code in. It should be like
this.

Dim r as Integer, i as Integer, MyNumbers as Variant
r = 4
MyNumbers = Array(1,1,1,3,1,1,3,1,1,2,1)
LastCellToTotal = Cells(r,NewSemLastCol - 1).Address
Range("A1").Activate
ActiveCell.Offset(3,NewSemLastCol).Select
ActiveCell.Formula = "=SUM(B" & r & ":" & LastCellToTotal & ")"
For i = 0 to 10
r = r + MyNumbers(i)
ActiveCell.Offset(MyNumbers(i),0).Formula = "=SUM(B" & r & ":" &
LastCellToTotal & ")"
Next i

Also, the use of the Array might need explaining. I have some rows in
the column that are not going to have a formula and some that have a
formula hard coded in a template. The layout of the sheet will not
change, so I can hard code the series of offsets into an array like
this, no?