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
| Private Sub CommandButton1_Click()
Application.Range("Lpalanquees").ClearContents
Application.Range("Lmoniteurs2").ClearContents
Call loadRotation
Call loadSorties
End Sub
Private Sub loadRotation()
Dim nbline As Integer, x As Integer, dlig As Integer
Dim pdate As Date
Dim ttc As Double
Dim protation As Integer
Call initColonnes
nbline = Application.Range("BDPlongees").Rows.Count
dlig = Application.Range("RPalanquee").Row + 1
pdate = Application.Range("Palanquee.date").Value
protation = Application.Range("Palanquee.rotation").Value
For x = 1 To nbline
If (Sheets("Plongees").Cells(x, PLDate).Value = pdate) Then
If (Sheets("Plongees").Cells(x, PLRotation).Value = protation) Then
Sheets("Palanquee").Cells(dlig, 2).Value = Sheets("Plongees").Cells(x, PLPrenom).Value
Sheets("Palanquee").Cells(dlig, 3).Value = Sheets("Plongees").Cells(x, PLNom).Value
If (Sheets("Plongees").Cells(x, PLPalanquee).Value <> "") Then
Sheets("Palanquee").Cells(dlig, 1).Value = Sheets("Plongees").Cells(x, PLPalanquee).Value
End If
Sheets("Palanquee").Cells(dlig, 4).Value = Sheets("Plongees").Cells(x, PLNiveau).Value
ttc = Sheets("Plongees").Cells(x, PLPUHT).Value
ttc = ttc + Sheets("Plongees").Cells(x, PLLocation).Value * Sheets("ref").Range("tarifLocation").Value
ttc = ttc + Sheets("Plongees").Cells(x, PLGaz).Value
Sheets("Palanquee").Cells(dlig, 7).Value = ttc
Sheets("Palanquee").Cells(dlig, 8).Value = Sheets("Plongees").Cells(x, PLPaye).Value
dlig = dlig + 1
End If
End If
Next x
End Sub
Private Sub loadSorties()
Dim l As Integer, c As Integer
Dim nbl As Integer, nbl2 As Integer
Dim pdate As Date
Dim protation As Integer
pdate = Application.Range("Palanquee.date").Value
protation = Application.Range("Palanquee.rotation").Value
nbl = Sheets("sorties").Range("A" & Rows.Count).End(xlUp).Row
nbl2 = 7
For l = 1 To nbl
If (Sheets("sorties").Cells(l, 1).Value = pdate) Then
If (Sheets("sorties").Cells(l, 2).Value = protation) Then
For c = 1 To 8
Sheets("Palanquee").Cells(nbl2, c).Value = Sheets("sorties").Cells(l, c + 4).Value
Next c
nbl2 = nbl2 + 1
If (nbl2 > 16) Then nbl2 = 16
End If
End If
Next l
End Sub |
Partager