<Sub sumpages()
Pages = InputBox("عدد الصفحات", "جمع الصفحات")
P = Pages
For i = 26 To 34 * P Step 34
Application.Calculation = xlCalculationManual
Range("F" & i).Select
ActiveCell.FormulaR1C1 = "=SUM(R[-20]C:R[-1]C)"
Next i
Range("f" & P * 34 - 7).Select
ActiveCell.FormulaR1C1 = "=R[-1]C+R[-35]C+R[-69]C+R[-103]C+R[-137]C+R[-171]C+R[-205]C+R[-239]C+R[-273]C+R[-307]C+R[-341]C+R[-375]C+R[-409]C+R[-443]C+R[-477]C+R[-511]C+R[-545]C+R[-579]C+R[-613]C+R[-647]C+R[-681]C+R[-715]C+R[-749]C+R[-783]C+R[-817]C+R[-851]C+R[-885]C+R[-919]C+R[-953]C+R[-987]C+R[-1021]C+R[-1055]C+R[-1089]C+R[-1123]C+R[-1157]C+R[-1191]C+R[-1225]C+R[-1259]C+R[-1293]C+R[-1327]C+R[-1361]C+R[-1395]C+R[-1429]C+R[-1463]C+R[-1497]C+R[-1531]C+R[-1565]C+R[-1599]C+R[-1633]C+R[-1667]C"
Application.Calculation = xlCalculationAutomatic
End Sub>