1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| Public Cout_Cuisine, Cout_demi, Cout_demiApres, Cout_Salle, Modif, Ligne_ecriture_modification
Public Valeur(21), Couleur, Nbr_jour_1, Heure_reser(3)
Public Date_deb_anc_reser, Date_fin_anc_reser, Salle_anc_reser
Public Sub Dessin_reservation()
Ligne_tableau = 3
Application.ScreenUpdating = False
Init_plage
date_debut_planning = Range("A3").Value
date_fin_planning = Range("A3").End(xlDown).Value
For cpt = 2 To Worksheets("reservations").Range("A1").End(xlDown).Row
If DateValue(Worksheets("reservations").Cells(cpt, 12).Value) >= DateValue(date_debut_planning) And DateValue(Worksheets("reservations").Cells(cpt, 12).Value) <= DateValue(date_fin_planning) Then
date_debut_reservation = DateValue(Worksheets("reservations").Cells(cpt, 12).Value)
date_fin_reservation = DateValue(Worksheets("reservations").Cells(cpt, 13).Value)
nombre_jours = date_fin_reservation - date_debut_reservation
Numero = Worksheets("reservations").Cells(cpt, 1).Value
civilite = Worksheets("reservations").Cells(cpt, 3).Value
Nom = Worksheets("reservations").Cells(cpt, 4).Value
Prenom = Worksheets("reservations").Cells(cpt, 5).Value
telephone = Worksheets("reservations").Cells(cpt, 9).Value
mail = Worksheets("reservations").Cells(cpt, 10).Value
salle = Worksheets("reservations").Cells(cpt, 11).Value
Cuisine = IIf(Worksheets("reservations").Cells(cpt, 14).Value = "Vrai", "Oui", "")
DemiAvant = IIf(Worksheets("reservations").Cells(cpt, 15).Value = "Vrai", "Oui", "")
cout = Worksheets("reservations").Cells(cpt, 17).Value
DemiApres = IIf(Worksheets("reservations").Cells(cpt, 18).Value = "Vrai", "Oui", "")
Infos = Worksheets("reservations").Cells(cpt, 19).Value
HeureReservation = Worksheets("reservations").Cells(cpt, 20).Value
ColonnePlanning = Worksheets("reservations").Cells(cpt, 21).Value
Set Ligne_ecriture = Cells.Find(date_debut_reservation)
If Ligne_ecriture Is Nothing Then GoTo 10
Ligne_ecriture = Cells.Find(date_debut_reservation).Row
If salle = "Grande Salle" Then
Couleur = 13762559
ElseIf salle = "Salle 3-5" Then
Couleur = 14277119
Else
Couleur = 14348258
End If
Cells(Ligne_ecriture, ColonnePlanning) = Numero '& "-" & Nom & " - (" & Cout & ") " & Cuisine & Chr(13) & Chr(10) & telephone
With Cells(Ligne_ecriture, ColonnePlanning)
.AddComment
.Comment.Visible = False
.Comment.Text Text:= _
"Réservation n° : " & Numero & Chr(10) & civilite & " " & Nom & " " & Prenom & Chr(10) & "Cout= " & cout & Chr(10) & "Mail : " & mail & Chr(10) & Infos & Chr(10) & "Heure : " & Format(HeureReservation, "hh:mm")
.Comment.Shape.TextFrame.AutoSize = True
.Comment.Shape.TextFrame.AutoSize = True
End With
If nombre_jours = 0 Then
Cells(Ligne_ecriture, ColonnePlanning).Interior.Color = Couleur
Else
Range(Cells(Ligne_ecriture, ColonnePlanning), Cells(Ligne_ecriture + nombre_jours, ColonnePlanning)).MergeCells = True
Range(Cells(Ligne_ecriture, ColonnePlanning), Cells(Ligne_ecriture + nombre_jours, ColonnePlanning)).Interior.Color = Couleur
End If
With Cells(Ligne_ecriture, ColonnePlanning).Font
.Bold = True
.ColorIndex = 3
End With
Range("M" & Ligne_tableau) = Numero
Range("M" & Ligne_tableau).Interior.Color = Couleur
Range("N" & Ligne_tableau) = Nom & " " & Prenom
Range("O" & Ligne_tableau) = telephone
Range("P" & Ligne_tableau) = Cuisine
Range("R" & Ligne_tableau) = DemiAvant
Range("S" & Ligne_tableau) = DemiApres
Ligne_tableau = Ligne_tableau + 1
End If
10 Next
Application.ScreenUpdating = True
End Sub
Sub Dessins()
If Valeur(11) = "Grande Salle" Then
Couleur = 13762559
ElseIf Valeur(11) = "Salle 3-5" Then
Couleur = 14277119
Else
Couleur = 14348258
End If
Col = ActiveCell().Column
If Modif = True Then
Ligne_deb_anc_reser = Range("A3:A33").Find(Date_deb_anc_reser).Row
Ligne_fin_anc_reser = Range("A3:A33").Find(Date_fin_anc_reser).Row
With Range(Cells(Ligne_deb_anc_reser, ActiveCell().Column), Cells(Ligne_fin_anc_reser, ActiveCell().Column))
.MergeCells = False
.ClearContents
.Borders().LineStyle = xlContinuous
.Interior.Pattern = xlNone
.ClearComments
End With
End If
LigneDeb = Range("A3:A33").Find(Valeur(12)).Row
Lignefin = Range("A3:A33").Find(Valeur(13)).Row
With Range(Cells(LigneDeb, Col), Cells(Lignefin, Col))
.MergeCells = True
.Interior.Color = Couleur
.Borders().LineStyle = xlContinuous
.Font.Bold = True
.Font.ColorIndex = 3
End With
With Cells(LigneDeb, Col)
.Value = Valeur(1)
.AddComment
.Comment.Visible = False
.Comment.Text Text:= _
"Réservation n° : " & Valeur(1) & Chr(10) & Valeur(3) & " " & Valeur(4) & " " & Valeur(5) & Chr(10) & "Cout= " & Valeur(17) & Chr(10) & "Mail : " & Valeur(10) & Chr(10) & "info : " & Valeur(19) & Chr(10) & "Heure : " & Valeur(20)
.Comment.Shape.TextFrame.AutoSize = True
End With
If Modif = True Then
Set c = Range("M3:M33").Find(Valeur(1))
Cells(c.Row, 13) = Valeur(1)
Cells(c.Row, 13).Interior.Color = Couleur
Cells(c.Row, 14) = Valeur(4)
Cells(c.Row, 15) = Valeur(9)
Cells(c.Row, 16) = IIf(Valeur(14), "Oui", "")
Cells(c.Row, 17) = IIf(Valeur(15), "Oui", "")
Cells(c.Row, 18) = IIf(Valeur(18), "Oui", "")
Else
Ligne_ecriture = Range("M2").End(xlDown).Row + 1
Cells(Ligne_ecriture, 13) = Valeur(1)
Cells(Ligne_ecriture, 13).Interior.Color = Couleur
Cells(Ligne_ecriture, 14) = Valeur(4)
Cells(Ligne_ecriture, 15) = Valeur(9)
Cells(Ligne_ecriture, 16) = IIf(Valeur(14), "Oui", "")
Cells(Ligne_ecriture, 17) = IIf(Valeur(15), "Oui", "")
Cells(Ligne_ecriture, 18) = IIf(Valeur(18), "Oui", "")
End If
End Sub |
Partager