Bonjour,
Je suis à nouveau bloqué et sollicite votre aide !
Grâce à la fonction suivante, après avoir rempli des textbox un stage est créé sur une ligne d'une feuille Excel.
J'aimerais coloré le stage créé fonction de ce qui est inséré dans la textbox5.
Par exemple si textbox5 = tb20 alors la couleur des cellules serait rouge, si textbox5 = be58 alors la couleur serait bleu...
En vous remerciant bien amicalement, parce que s'occuper de ça, alors que je n'y connait rien (ou vraiment pas grand chose), serait impossible sans votre aide.
Antoine
Option Explicit
Sub insererStage(ByVal ligne, ByVal colonne, ByVal nomstage, ByVal nbSemaines, ByVal nbStagiaires, ByVal promotion, ByVal remarque, ByVal avion, ByRef tb20, ByRef be58)
'chercher la ligne a laquelle le stage doit etre inserer
Dim cell As Variant
For Each cell In Range(Sheets(C_ongletPDC).Cells(ligne + 1, colonne), Sheets(C_ongletPDC).Cells(ligne + 1, colonne + nbSemaines - 1))
cell.Value = nbStagiaires
Next
Call setNomStage(ligne, colonne, colonne + nbSemaines - 1, nomstage, nbStagiaires, promotion, remarque)
With Range(Sheets(C_ongletPDC).Cells(ligne, colonne), Sheets(C_ongletPDC).Cells(ligne + 1, colonne + nbSemaines - 1))
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlInsideHorizontal).Weight = xlMedium
.Borders(xlInsideVertical).LineStyle = xlNone
.Select
End With
End Sub