E
eideal44
Guest
Bonsoir,
J'aurais besoin d'un coup de main car j'ai créé du code sur excel mais je souhaiterais l'allégé si c'était possible.
Je vous mets mon code VBA :
Sub SEMAINE_ENTREE()
SEMAINE = DatePart("ww", TextBox4.Value, 2, 2)
If ListBox2.ListIndex = 0 Then
Cells(7, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(7, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 1 Then
Cells(23, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(23, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 2 Then
Cells(39, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(39, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 3 Then
Cells(55, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(55, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 4 Then
Cells(71, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(71, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 5 Then
Cells(87, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(87, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 6 Then
Cells(103, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(103, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 7 Then
Cells(119, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(119, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 8 Then
Cells(135, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(135, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 9 Then
Cells(151, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(151, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 10 Then
Cells(167, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(167, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 11 Then
Cells(183, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(183, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
End If
End Sub
Si quelqu'un pouvait m'aider, ça serait génial car je commence à devenir mou du cerveau.
D'avance merci.
Eideal
J'aurais besoin d'un coup de main car j'ai créé du code sur excel mais je souhaiterais l'allégé si c'était possible.
Je vous mets mon code VBA :
Sub SEMAINE_ENTREE()
SEMAINE = DatePart("ww", TextBox4.Value, 2, 2)
If ListBox2.ListIndex = 0 Then
Cells(7, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(7, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 1 Then
Cells(23, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(23, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 2 Then
Cells(39, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(39, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 3 Then
Cells(55, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(55, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 4 Then
Cells(71, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(71, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 5 Then
Cells(87, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(87, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 6 Then
Cells(103, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(103, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 7 Then
Cells(119, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(119, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 8 Then
Cells(135, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(135, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 9 Then
Cells(151, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(151, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 10 Then
Cells(167, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(167, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
ElseIf ListBox2.ListIndex = 11 Then
Cells(183, 4 + SEMAINE).Interior.ColorIndex = 10
Cells(183, 4 + SEMAINE).Value = Left(TextBox4.Value, 2)
End If
End Sub
Si quelqu'un pouvait m'aider, ça serait génial car je commence à devenir mou du cerveau.
D'avance merci.
Eideal
Dernière modification par un modérateur: