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
| Sub PMI()
'##############Définition des colonnes en format dates#####################
Dim i As Long
Dim stock As Date
fin = Range("A3").End(xlDown).Row
'##############Définition des colonnes en format dates#####################
Columns("D:E").Select
Selection.NumberFormat = "dd/MM/yyyy"
Columns("F").Select
Selection.NumberFormat = "General"
'###############Transformation de la périodicité en jours##################
For i = 3 To fin
Cells(i, 6).Select
If Cells(i, 6).Value = "4 Ans" Then
Cells(i, 6).Value = "1460"
End If
If Cells(i, 6).Value = "3 Ans" Then
Cells(i, 6).Value = "1095"
End If
If Cells(i, 6).Value = "2 Ans" Then
Cells(i, 6).Value = "730"
End If
If Cells(i, 6).Value = "1 Ans" Then
Cells(i, 6).Value = "365"
End If
If Cells(i, 6).Value = "18 Mois" Then
Cells(i, 6).Value = "548"
End If
If Cells(i, 6).Value = "6 Mois" Then
Cells(i, 6).Value = "183"
End If
If Cells(i, 6).Value = "4 Mois" Then
Cells(i, 6).Value = "122"
End If
Next i
'############### Réécriture de la date prochaine ##################
For i = 3 To fin
Cells(i, 5).Select
Cells(i, 4).Select
Cells(i, 6).Select
If Cells(i, 5).Value = "-" Then
Cells(i, 5).Value = Application.Sum(Cells(i, 4).Value, Cells(i, 6).Value)
End If
Next i
'############### Définition de l'intervalle de travail ##################
DateDebut = InputBox("Entrer la date ", " Date de debut d'intervalle ", "01/01/2013 ")
MsgBox "Bonjour" & Chr(10) & "La date est " & DateDebut
DateFin = InputBox("Entrer la date ", " Date de fin d'intervalle ", "01/01/2013 ")
MsgBox "Bonjour" & Chr(10) & "La date est " & DateFin
For i = 3 To fin
stock = Cells(i, 5).Value
If stock > DateDebut And stock < DateFin Then
Cells(i, 7) = True
Else: Cells(i, 7) = False
End If
Next i
For i = fin To 3 Step -1
If Cells(i, 7) = False Then
Rows(i).Delete
End If
Next i
'############### Propeté du rapport ##################
Columns("G").Select
Selection.ClearContents
End Sub |
Partager