Yes this is the whole code, which links 3 worksheets, which also have codes:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i, nr, k, nr2 As Long
' Exit if multiple cells updating simultaneously
If Target.CountLarge > 1 Then Exit Sub
' Only run if cell B1 updated
If Target.Address = Range("D5").Address Then
' Only run if numeric value entered
If IsNumeric(Target.Value) And (Target.Value > 0) Then
Application.ScreenUpdating = False
Application.EnableEvents = False
' Set default value of next row
nr = 41
nr2 = 19
' Loop through number of times to copy
For i = 1 To (Int(Target.Value) - 1)
' Copy values from A2:B5 to next range
Range("A20:E40").Copy Cells(nr, "A")
Cells(nr, "A").Interior.ColorIndex = 35
Cells(nr, "D").Formula = "bla"
' Increment next start by 4 rows
For k = 1 To 20
If k = 3 Then
Cells(nr + k, "D").Formula = "=VLOOKUP('User Input'!$C" & nr2 + 3 & ",'Work process list'!$A$2:$B$11,2,FALSE)"
End If
If k = 4 Then
Cells(nr + k, "D").Formula = "=3.14*'User Input'!$C" & nr2 + 1 & "8*0.001*'User Input'!$C" & nr2 + 1 & "*0.001/4"
End If
If k = 6 Then
Cells(nr + k, "D").Formula = "=66.4*'User Input'!C" & nr2 + 1 & "*Calculations!D" & nr + 1
End If
If k = 7 Then
Cells(nr + k, "D").Formula = "=IF((0.11*POWER((($D$3/('User Input'!$C" & nr2 + 1 & "))+(68/$D" & nr + 5 & ")),0.25))>0.018,(0.11*POWER((($D$3/('User Input'!C" & nr2 + 1 & "))+(68/D" & nr + 5 & ")),0.25)),(0.85*(0.11*POWER((($D$3/('User Input'!C" & nr2 + 1 & "))+(68/D" & nr + 5 & ")),0.25))+0.0028))"
End If
If k = 8 Then
Cells(nr + k, "D").Formula = "=($D" & nr + 6 & "*'User Input'!C" & nr2 + 2 & "*$D$4*D" & nr + 6 & "*D" & nr + 6 & ")/(2*'User Input'!C" & nr2 + 1 & "/1000)"
End If
If k = 11 Then
Cells(nr + k, "D").Formula = "=$D" & nr + 9 & "/'User Input'!$C" & nr2 + 1 & ""
End If
If k = 13 Then
Cells(nr + k, "D").Formula = "=VLOOKUP('User Input'!C" & nr2 + 5 & ",Tables!$A$35:$K$41,VALUE(MATCH('User Input'!C" & nr2 + 6 & ",Tables!$B$34:$K$34,0))+1,TRUE)"
End If
If k = 14 Then
Cells(nr + k, "D").Formula = "=((D" & nr + 14 & "*$D$4*D" & nr + 2 & "*D" & nr + 2 & ")/2)*'User Input'!C" & nr2 + 4 & ""
End If
If k = 15 Then
Cells(nr + k, "D").Formula = "=INDEX(Tables!$B$27:$H$27, MATCH(MIN(ABS(Tables!$B$27:$H$27-'User Input'!C" & nr2 + 1 & ")),ABS(Tables!$B$27:$H$27-'User Input'!C" & nr2 + 1 & "),0))"
End If
If k = 16 Then
Cells(nr + k, "D").Formula = "=VLOOKUP('User Input'!C" & nr2 + 7 & ",Tables!$A$28:$H$30,VALUE(MATCH($D" & nr + 15 & ",Tables!$B$27:$H$27,0))+1,TRUE)"
End If
If k = 17 Then
Cells(nr + k, "D").Formula = "=(($D" & nr + 16 & "*$D$4*D" & nr + 1 & "*D" & nr + 1 & ")/2)*'User Input'!C" & nr2 + 6 & ""
End If
If k = 18 Then
Cells(nr + k, "D").Formula = "=VLOOKUP('User Input'!C" & nr2 + 9 & ",Tables!$A$18:$M$24,VALUE(MATCH('User Input'!C" & nr2 + 10 & ",Tables!$B$18:$M$18,0))+1,TRUE)"
End If
If k = 19 Then
Cells(nr + k, "D").Formula = "=((D" & nr + 18 & "*$D$4*D" & nr + 1 & "*D" & nr + 1 & ")/2)*'User Input'!C" & nr2 + 8 & ""
End If
Next k
nr = nr + 21
nr2 = nr2 + 12
Next i
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End If
End Sub