Hello, 2nd post here.
I have this code :
I think i got a little bit lost because my loop doesn't end. Excel keeps on asking me to fill the first inputbox even if i've already done it. It seems that my 2 Exit for are useless.
If you see what's wrong please tell me
Thank you
I have this code :
Code:
Sub creer_tache()
Dim nom_liaison_tache As Variant
Dim nom_projet_liaison_tache As Variant
Dim check_P As Boolean
Dim check_ssp As Boolean
check_P = False
check_ssp = False
Dim i As Integer
For i = 1 To 20
nom_projet_liaison_tache = InputBox("dans quel projet se trouve cette tache ?", "LIAISON")
'Si le projet est trouvé
If nom_projet_liaison_tache = List_Projet(i).nom_P Then
check_P = True
Sheets(nom_projet_liaison_tache).Select
nom_liaison_tache = InputBox("Avec quel sous-projet cette tache est liée ?", "LIAISON")
Dim j As Integer
For j = 1 To 20
'Si le ssp est trouvé
If nom_liaison_tache = List_SSP(j).nom_ssp Then
check_ssp = True
Range(nom_liaison_tache).Select
End If
Dim indice As Integer
indice = 0
'Tant que la cellule est occupée
Do While ActiveCell.Offset(indice, 0).Value <> Empty
indice = indice + 1
Loop
Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(indice + 1, 7)).Select
Selection.Cut
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(-1, 0).Select
'NOM
List_tache(id_tache).nom_tache = InputBox("nom de cette tache ?")
ActiveCell.Offset(0, 0).Value = List_tache(id_tache).nom_tache
'ID
List_tache(id_tache).id_tache = InputBox("id de cette tache ?")
ActiveCell.Offset(0, 1).Value = List_tache(id_tache).id_tache
'DEADLINE
List_tache(id_tache).deadline_tache = InputBox("deadline de cette tache ?")
ActiveCell.Offset(0, 2).Value = List_tache(id_tache).deadline_tache
'STATUT
List_tache(id_tache).statut_tache = InputBox("statut de cette tache ?")
ActiveCell.Offset(0, 3).Value = List_tache(id_tache).statut_tache
'DEBUT
List_tache(id_tache).date_debut_tache = InputBox("Début de cette tache ?")
ActiveCell.Offset(0, 4).Value = List_tache(id_tache).date_debut_tache
'FIN
List_tache(id_tache).date_fin_tache = InputBox("Fin de cette tache ?")
ActiveCell.Offset(0, 5).Value = List_tache(id_tache).date_fin_tache
'COUT PREV
List_tache(id_tache).cout_prev_tache = InputBox("cout prev de cette tache ?")
ActiveCell.Offset(0, 6).Value = List_tache(id_tache).cout_prev_tache
'COUT REEL
List_tache(id_tache).cout_reel_tache = InputBox("Cout réel de cette tache ?")
ActiveCell.Offset(0, 7).Value = List_tache(id_tache).cout_reel_tache
'On nomme la ligne par le nom du ssp
Range(ActiveCell, ActiveCell.Offset(0, 7)).Select
ActiveWorkbook.Names.Add Name:=List_tache(id_tache).nom_tache, RefersToR1C1:= _
"=test!R6C4:R6C11"
Exit For
Exit For
Next j
End If
Next i
If check_P = False Then
MsgBox ("Il n'y a pas de projet de ce nom")
End If
If check_ssp = False Then
MsgBox ("il n'y a pas de ssp de ce nom")
End If
End Sub
I think i got a little bit lost because my loop doesn't end. Excel keeps on asking me to fill the first inputbox even if i've already done it. It seems that my 2 Exit for are useless.
If you see what's wrong please tell me

Thank you