View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
thiaga
 
Posts: n/a
Default Sum on rows column wise - Strange error

I am trying to sum all the rows in a range column wise

Values Start from G9 and ends at Rx (x is the last row num)
The values get populated based on a selection from a list.
The below code works perfect when i change the selection once.
But when i change the selection again, the first row (i.e 9th gets
filled with #REF)

With Sheets("Sheet1")
col = "G"
For i = 1 To 12
Range(col & (x + 1)).Cells.Formula = "=Sum(" & col & "9:" &
col & x & ")"
col = Chr(Asc(col) + 1)
Next i
End With


Any thoughts?

Regards
Thiaga