You can't embed the sub within another sub, create them as distinct entities, something like this

Private Sub OK_Click()
     
    Unload Userform1
     
    Worksheets("Data").Cells(1, 1).Select
     'Worksheets("Data").Cells(2, 1). = ActiveCell
    Do While ActiveCell.Value <> Empty
        rowNr = rowNr + 1
        ActiveCell.Offset(1, 0).Select
    Loop
     'MsgBox rowNr
    rowNr = rowNr + 1
     
     
    Worksheets("Data").Cells(2, 3) = CheckBox1.Value
    Worksheets("Data").Cells(3, 3) = CheckBox2.Value
    Worksheets("Data").Cells(4, 3) = CheckBox3.Value
    Worksheets("Data").Cells(5, 3) = CheckBox4.Value
    Worksheets("Data").Cells(6, 3) = CheckBox5.Value
    Worksheets("Data").Cells(7, 3) = CheckBox6.Value
    Worksheets("Data").Cells(8, 3) = CheckBox7.Value
    Worksheets("Data").Cells(9, 3) = CheckBox8.Value
    Worksheets("Data").Cells(10, 3) = CheckBox9.Value
    Worksheets("Data").Cells(11, 3) = CheckBox10.Value
     
    Call Sheets40and39
    Call Sheets3_40and4_40
    'more calls
End Sub
    
Private Sub Sheets40and39()
    If CheckBox1 = True And CheckBox2 = True And CheckBox3 = True And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = True And CheckBox8 = True And CheckBox9 = True And CheckBox10 = True And CheckBox11 = True And CheckBox12 = True And CheckBox13 = True And CheckBox14 = True And CheckBox15 = True And CheckBox16 = True And CheckBox17 = True And CheckBox18 = True And CheckBox19 = True And CheckBox20 = True And CheckBox21 = True And CheckBox22 = True And CheckBox23 = True And CheckBox24 = True And CheckBox25 = True And CheckBox26 = True And CheckBox27 = True And CheckBox28 = True And CheckBox29 = True And CheckBox30 = True And CheckBox31 = True And CheckBox32 = True And CheckBox33 = True And CheckBox34 = True And CheckBox35 = True And CheckBox36 = True And CheckBox37 = True And CheckBox38 = True And CheckBox39 = True And CheckBox40 = True Then
        Sheets("Template").Copy
        ActiveSheet.Name = "TC1-40"
         
    ElseIf CheckBox1 = True And CheckBox2 = True And CheckBox3 = True And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = True And CheckBox8 = True And CheckBox9 = True And CheckBox10 = True And CheckBox11 = True And CheckBox12 = True And CheckBox13 = True And CheckBox14 = True And CheckBox15 = True And CheckBox16 = True And CheckBox17 = True And CheckBox18 = True And CheckBox19 = True And CheckBox20 = True And CheckBox21 = True And CheckBox22 = True And CheckBox23 = True And CheckBox24 = True And CheckBox25 = True And CheckBox26 = True And CheckBox27 = True And CheckBox28 = True And CheckBox29 = True And CheckBox30 = True And CheckBox31 = True And CheckBox32 = True And CheckBox33 = True And CheckBox34 = True And CheckBox35 = True And CheckBox36 = True And CheckBox37 = True And CheckBox38 = True And CheckBox39 = True Then
        Sheets("Template").Copy
        ActiveSheet.Name = "TC1-39"
        Rows(1).Rows(52).Delete
    End If
End Sub
    
Private Sub Sheets3_40and4_40()
    If CheckBox1 = True And CheckBox3 = True And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = True And CheckBox8 = True And CheckBox9 = True And CheckBox10 = True And CheckBox11 = True And CheckBox12 = True And CheckBox13 = True And CheckBox14 = True And CheckBox15 = True And CheckBox16 = True And CheckBox17 = True And CheckBox18 = True And CheckBox19 = True And CheckBox20 = True And CheckBox21 = True And CheckBox22 = True And CheckBox23 = True And CheckBox24 = True And CheckBox25 = True And CheckBox26 = True And CheckBox27 = True And CheckBox28 = True And CheckBox29 = True And CheckBox30 = True And CheckBox31 = True And CheckBox32 = True And CheckBox33 = True And CheckBox34 = True And CheckBox35 = True And CheckBox36 = True And CheckBox37 = True And CheckBox38 = True And CheckBox39 = True And CheckBox40 = True Then
        Sheets("Template").Copy
        ActiveSheet.Name = "TC1,3-40"
        Rows(1).Rows(4).Delete
         
    ElseIf CheckBox1 = True And CheckBox2 = True And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = True And CheckBox8 = True And CheckBox9 = True And CheckBox10 = True And CheckBox11 = True And CheckBox12 = True And CheckBox13 = True And CheckBox14 = True And CheckBox15 = True And CheckBox16 = True And CheckBox17 = True And CheckBox18 = True And CheckBox19 = True And CheckBox20 = True And CheckBox21 = True And CheckBox22 = True And CheckBox23 = True And CheckBox24 = True And CheckBox25 = True And CheckBox26 = True And CheckBox27 = True And CheckBox28 = True And CheckBox29 = True And CheckBox30 = True And CheckBox31 = True And CheckBox32 = True And CheckBox33 = True And CheckBox34 = True And CheckBox35 = True And CheckBox36 = True And CheckBox37 = True And CheckBox38 = True And CheckBox39 = True And CheckBox40 = True Then
        Sheets("Template").Copy
        ActiveSheet.Name = "TC1-2,4-40"
        Rows(1).Rows(5).Delete
    End If
End Sub

'etc
Your code will do more checking than the current does (or would do if it worked), but that is a price you pay for this approach.

You could include more checks in each called sub, I just showed the approach.

I still think you should rethink your approach, I am sure you will get caught at the next hurdle as well.