Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
i am trying to sum a range of values from coloumn H to Column i. i is a variable, and it depends on the input no for Cloumn F. If column F is 6, that means that values need to be summed up from Column H to M( 6 columns counting from H as a reference). but this does not work, can anyone advise anything wrong with my code??? The result will be returned in Column G. pls see code below: Sub Book1() Application.ScreenUpdating = False Dim CurrentRow As Integer Dim NumOfRows As Integer Dim i As Integer NumOfRows = Cells(Rows.Count, 1).End(xlUp).Row For CurrentRow = 2 To NumOfRows i = Cells(CurrentRow, "F").Value With ActiveSheet .Range("G2").Select .Range("G" & CurrentRow).FormulaR1C1 _ = "=SUM(RC[1]:RC[i])" End With Next Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
R1C1 | Excel Discussion (Misc queries) | |||
help on Converting R1C1 to A1 and A1 to R1C1..tia sa2 | Excel Discussion (Misc queries) | |||
help on Converting R1C1 to A1 and A1 to R1C1..tia sa2 | Excel Worksheet Functions | |||
R1C1 | Excel Discussion (Misc queries) | |||
R1C1 Fix | Excel Programming |