View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Les Stout[_2_] Les Stout[_2_] is offline
external usenet poster
 
Posts: 396
Default Loop and fill Question

Hi Ram, sorry made a few errors with the last script, try this, it adds
row a & B and put the formula in C.

Sub InsertCalcE()
Dim rng As Range
Dim Lrow1 As Long
Dim CalcMode As Long
Const col As String = "A" '<<== CHANGE to column
Application.EnableEvents = False
Lrow1 = Cells(Rows.Count, col).End(xlUp).Row

On Error GoTo XIT

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

Set rng = Range(col & "1:" & col & Lrow1) '<-Change to from row No.
With rng
.Offset(0, 2).FormulaR1C1 = "=SUM(RC[-2]+RC[-1])" '<<== CHANGE
End With

XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With

End Sub

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***