ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Sum on rows column wise - Strange error (https://www.excelbanter.com/excel-worksheet-functions/74731-sum-rows-column-wise-strange-error.html)

thiaga

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



All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com