Mon Mar 24, 2014 9:44 am
Thank you so much Gary.
I would like to loop thr the cells at Row 5, and copy the cell formulas to Row 6 - 50.
The following are the codes.
Is there a smarter way to copy the formulas without using the 'replace' function - to increment the row count?
'loop all cells at Row 5
For Each cell In objSheet1.Range("B5:FS5")
If cell.Formula > "" Then
'formula exists, apply same formula to Row 6 - 50
For iRow = 6 To 50
'Eg Cell formula: =SUMIF($AE$3:$AP$3,AQ$3,$AE5:$AP5)
objSheet1.Range(iRow, cell.Column).Formula = cell.Formula.Replace("5", iRow.ToString.Trim)
Next
End If
Next
Many Thanks