Hi,
apologies for my incomplete answer, but try this which uses the same technique but does a double loop
Sub test() With ThisWorkbook.Sheets("Sheet1") lLR = Cells(Rows.Count, "A").End(xlUp).Row End With inarr = Range("AY59:EX" & lLR) 'assigning the main loading formula Application.StatusBar = " Automated Planning : Computing ...." ' With Range("AY59:EX" & lLR) ' .Formula = "=IF(OR($AF59="""",$AF59="""",$AJ59=""""),0,IF(AY$58<$AJ59,0,IF(AY$58>=$AJ59,IF(0<($AN59),MIN(($AN59-'SUM(AX59:$AX59)),$AO59,SUMIF(Shadow_Dept_Lines_Sum_Col,$AM59,AY$4:AY$56)-SUMIF($AM$58:$AM58,$AM59,AY$58))))))" ' '.Application.Calculation = xlCalculationAutomatic ' .Value = .Value ' End With endarray = 59 - lLR ' column ex is column 154 column ay is column 59 endcol = 154 - 51 For i = 1 To endarray For j = 1 To endcol inarr(i, j) = "=IF(OR($AF59="""",$AF59="""",$AJ59=""""),0,IF(AY$58<$AJ59,0,IF(AY$58>=$AJ59,IF(0<($AN59),MIN(($AN59-SUM(AX59:$AX59)),$AO59,SUMIF(Shadow_Dept_Lines_Sum_Col,$AM59,AY$4:AY$56)-SUMIF($AM$58:$AM58,$AM59,AY$58))))))" Next j Next i Range("AY59:EX" & lLR) = inarr End Sub




Reply With Quote