Private Sub ListBoxVh_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
If ComboNomUtilisateur.ListIndex = -1 Then
InsérerNomDansLaBase
End If
With Worksheets(ListBoxVh.Value)
If CDate(ComboDateDébut) = CDate(ComboDateFin) Then
.Cells(LigneDeDateDébut, ColonneDébut) = ComboNomUtilisateur
For compteurDeColonne = ColonneDébut To ColonneFin
.Cells(LigneDeDateDébut, compteurDeColonne).Interior.ColorIndex = 35
Next
CelluleAEntourer = Range(.Cells(LigneDeDateDébut, ColonneDébut), .Cells(LigneDeDateDébut, compteurDeColonne - 1)).Address
Contour
Couleur
ElseIf CDate(ComboDateFin) = CDate(ComboDateDébut) + 1 Then
.Cells(LigneDeDateDébut, ColonneDébut) = ComboNomUtilisateur
For compteurDeColonne = ColonneDébut To 25
.Cells(LigneDeDateDébut, compteurDeColonne).Interior.ColorIndex = 35
Next
CelluleAEntourer = Range(.Cells(LigneDeDateDébut, ColonneDébut), .Cells(LigneDeDateDébut, compteurDeColonne - 1)).Address
Contour
[COLOR="Red"]Sub Couleur()
Worksheets(ListBoxVh.Value).Range(CelluleAEntourer).Interior.ColorIndex = Worksheets("FeuilleDeTravail").Range("J3").Interior.ColorIndex
End Sub[/COLOR]
For compteurDeColonne = 2 To ColonneFin - 1
.Cells(LigneDeDatefin, compteurDeColonne).Interior.ColorIndex = 35
Next
.Cells(LigneDeDatefin, 2) = ComboNomUtilisateur
CelluleAEntourer = Range(.Cells(LigneDeDatefin, 2), .Cells(LigneDeDatefin, compteurDeColonne - 1)).Address
Contour
Couleur
ElseIf CDate(ComboDateFin) > CDate(ComboDateDébut) + 1 Then
For compteurDeColonne = ColonneDébut To 25
.Cells(LigneDeDateDébut, compteurDeColonne).Interior.ColorIndex = 35
Next
.Cells(LigneDeDateDébut, ColonneDébut) = ComboNomUtilisateur
CelluleAEntourer = Range(.Cells(LigneDeDateDébut, ColonneDébut), .Cells(LigneDeDateDébut, compteurDeColonne - 1)).Address
Contour
Couleur
For CompteurDeLigne = 1 To (CDate(ComboDateFin) - CDate(ComboDateDébut) - 1)
For compteurDeColonne = 2 To 25
.Cells(LigneDeDateDébut + CompteurDeLigne, compteurDeColonne).Interior.ColorIndex = 35
Next
.Cells(LigneDeDateDébut + CompteurDeLigne, 2) = ComboNomUtilisateur
CelluleAEntourer = Range(.Cells(LigneDeDateDébut + CompteurDeLigne, 2), .Cells(LigneDeDateDébut + CompteurDeLigne, 25)).Address
Contour
Couleur
Next
.Cells(LigneDeDateDébut + 1, 2) = ComboNomUtilisateur
CelluleAEntourer = Range(.Cells(LigneDeDateDébut + 1, 2), .Cells(LigneDeDateDébut + 1, 25)).Address
Contour
Couleur
For compteurDeColonne = 2 To ColonneFin
.Cells(LigneDeDatefin, compteurDeColonne).Interior.ColorIndex = 35
Next
.Cells(LigneDeDatefin, 2) = ComboNomUtilisateur
CelluleAEntourer = Range(.Cells(LigneDeDatefin, 2), .Cells(LigneDeDatefin, compteurDeColonne - 1)).Address
Contour
Couleur
End If
End With
Unload Me
MsgBox " Réservation effectuée"
End Sub
Sub Couleur()
Worksheets(ListBoxVh.Value).Range(CelluleAEntourer).Interior.ColorIndex = Worksheets("FeuilleDeTravail").Range("J3").Interior.ColorIndex
End Sub