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
|
Private Sub MonteeExport_Click()
Dim MaPlage As Range, Trouve As Range
Dim NomFichier As String
Dim DerniereLigneNonVide As Integer, NumColExport As Integer
Dim Adresse1 As String
DerniereLigneNonVide = Sheets("SUIVI_OBJETS").Range("D65536").End(xlUp).Row
NumColExport = NumColonneExportSelectionne
If Me.ListeExport <> "" Then
If NumColExport <> Nul And NumColExport > 0 Then
Set MaPlage = Sheets("SUIVI_OBJETS").Range(Cells(6, NumColExport), Cells(DerniereLigneNonVide, NumColExport))
Set Trouve = MaPlage.Find("x", MaPlage.Cells(1), xlValues, xlWhole, xlByRows, xlNext)
If Not Trouve Is Nothing Then
Adresse1 = Trouve.Address
NomFichier = Range("D" & Trouve.Row).Value
If Me.RecetteE = True Then
Do
DecocheOldVersion DerniereLigneNonVide, NomFichier, "G"
Sheets("SUIVI_OBJETS").Range("G" & Trouve.Row).Value = "x" 'Environnement recette
Sheets("SUIVI_OBJETS").Range("K" & Trouve.Row).Value = TranscoQuadri 'Quadrigramme responsable
Sheets("SUIVI_OBJETS").Range("L" & Trouve.Row).Value = Date 'Date installation recette
Set Trouve = MaPlage.FindNext(Trouve)
Loop While StrComp(Adresse1, Trouve.Address) <> 0
Else
Do
DecocheOldVersion DerniereLigneNonVide, NomFichier, "H"
Sheets("SUIVI_OBJETS").Range("H" & Trouve.Row).Value = "x" 'Environnement production
Sheets("SUIVI_OBJETS").Range("M" & Trouve.Row).Value = TranscoQuadri 'Quadrigramme responsable
Sheets("SUIVI_OBJETS").Range("N" & Trouve.Row).Value = Date 'Date installation recette
Set Trouve = MaPlage.FindNext(Trouve)
Loop While StrComp(Adresse1, Trouve.Address) <> 0
End If
End If
Else
MsgBox "Export inexistant, utilisez de préférence la liste déroulante.", vbInformation, "Erreur de mise à jour"
End If
Else
MsgBox "Vous devez entrer le nom du document mis à jour.", vbInformation, "Erreur de mise à jour"
Me.ListeExport.SetFocus
End If
End Sub
Private Function NumColonneExportSelectionne()
Dim MaPlage As Range, Cell As Range
Dim DerniereColonneNonVide As Integer
DerniereColonneNonVide = Sheets("SUIVI_OBJETS").Range("P2").End(xlToRight).Column - 2
For Each Cell In Sheets("SUIVI_OBJETS").Range(Cells(2, 16), Cells(2, DerniereColonneNonVide))
If Cell.Value = Me.ListeExport Then
NumColonneExportSelectionne = Cell.Column
End If
Next Cell
End Function
Private Sub DecocheOldVersion(ByVal DerniereLigneNonVide As Integer, ByVal NomFichier As String, ByVal Environnement As String)
Dim MaPlage As Range, Trouve As Range
Dim Adresse As String
Set MaPlage = Sheets("SUIVI_OBJETS").Range(Cells(6, 4), Cells(DerniereLigneNonVide, 4))
Set Trouve = MaPlage.Find(NomFichier, MaPlage.Cells(1), xlValues, xlWhole, xlByRows, xlNext)
If Not Trouve Is Nothing Then
Adresse = Trouve.Address
Do
Sheets("SUIVI_OBJETS").Range(Environnement & Trouve.Row).Value = "" ' Decoche l ancienne version
Set Trouve = MaPlage.FindNext(Trouve)
Loop While StrComp(Adresse, Trouve.Address) <> 0
End If
End Sub |
Partager