Try this modefied macro:

Sub macro8()

Dim cell As Range
Dim i As Integer

 Sheets("dzienne st zwrotu").Activate

Range("A73").FormulaR1C1 = "=AVERAGE(R[-66]C:R[-47]C)"
Range("C73").FormulaR1C1 = "=AVERAGE(R[-66]C:R[-47]C)"
Range("C73").AutoFill Destination:=Range("C73:AG73"), Type:=xlFillDefault

Sheets("VAR").Activate
Range("C7").FormulaR1C1 = "=INT(R[4]C/INDIRECT(R4C&""!G4""))"
Range("C7").AutoFill Destination:=Range("C7:AG7"), Type:=xlFillDefault

Range("H24").FormulaR1C1 = "=INT(R[1]C/XLU!R[-20]C[-1])"
Range("C8").FormulaR1C1 = "=INDIRECT(R4C&""!B3"")"
Range("C8").AutoFill Destination:=Range("C8:AG8"), Type:=xlFillDefault

Range("C9").FormulaR1C1 = "=INDIRECT(R4C&""!E3"")"
Range("C9").AutoFill Destination:=Range("C9:AG9"), Type:=xlFillDefault
Range("H26").FormulaR1C1 = "=XLU!R[-23]C[-6]"
Range("H27").FormulaR1C1 = "=XLU!R[-24]C[-3]"

i = Range("B" & Rows.Count).End(xlUp).Row

For Each cell In Range("B38:B" & i)

cell.Copy
Range("G36").PasteSpecial Paste:=xlPasteValues

If i - cell.Row >= 20 Then
    Range("G37") = 20
Else
    Range("G37") = i - cell.Row
End If

SolverOk SetCell:="$C$19", MaxMinVal:=1, ValueOf:="0", ByChange:="$C$11:$AG$11"
SolverSolve UserFinish:=True

Range("J30").Copy
 cell.Offset(0, 1).PasteSpecial Paste:=xlPasteValues
 
Next

Application.CutCopyMode = False

End Sub
As your date format i.e. Jun 12, 2013 is rather strange I have used copy and PasteSpecial to get it transferred in the right format to G36. The value in G37 is set to 20 if row difference (last row - actual row) is equal to or greater than 20. If less the actual difference is used.

I really would like to set date difference in days but I can't use your date format in calculating number of days.

Alf