modification code vba

Tournament

XLDnaute Nouveau
Bonjour,

je souhaiterais modifier la fin de ce code
Merci d avance pour votre aide



Code:
Sub Hmc()
    Const AG = "MDL"
 
    With Feuil2.Cells(1).CurrentRegion
        For R& = 1 To .Rows.Count
            If .Cells(R, 7).Text = AG And .Cells(R, 4).Value < Date Then T$ = T$ & vbLf & .Cells(R, 6).Text & vbTab & vbTab & .Cells(R, 5).Text & vbTab & vbTab & .Cells(R, 1).Text & vbTab
        Next
    End With
 
    If T > "" Then MsgBox "date de retour dépassée !" & Chr(10) & Chr(10) & "NO DOC" & vbTab & vbTab & "TYPE DE DOC" & vbTab & "IMMAT" & T, vbExclamation, "   EN DATE DEPASSEE " & AG
 
'si OK quitter la procédure 
'si il n y a pas de doc a date dépassé msgbox pour dire "pas de date dépassee"
'alors Call macro(xxxx)
 
End Sub
 

gilbert_RGI

XLDnaute Barbatruc
Re : modification code vba

Bonjour et bienvenue sur XLD

est-ce ceci que vous voulez obtenir

VB:
Sub Hmc()
    Const AG = "MDL"
 
    With Feuil2.Cells(1).CurrentRegion
        For R& = 1 To .Rows.Count
            If .Cells(R, 7).Text = AG And .Cells(R, 4).Value < Date Then T$ = T$ & vbLf & .Cells(R, 6).Text & vbTab & vbTab & .Cells(R, 5).Text & vbTab & vbTab & .Cells(R, 1).Text & vbTab
        Next
    End With
 
    If T > "" Then
    rep = MsgBox("date de retour dépassée !" & Chr(10) & Chr(10) & "NO DOC" & vbTab & vbTab & "TYPE DE DOC" & vbTab & "IMMAT" & T, vbExclamation + vbYesNoCancel, "   EN DATE DEPASSEE " & AG)
End If
 If rep = vbYes Then Call macro
 If rep = vbNo Then MsgBox "la date est dépassée"
 If rep = vbCancel Then Exit Sub
'si OK quitter la procédure
'si il n y a pas de doc a date dépassé msgbox pour dire "pas de date dépassee"
'alors Call macro(xxxx)
 
End Sub
Sub macro()
MsgBox "ok"
End Sub
 

Statistiques des forums

Discussions
312 671
Messages
2 090 763
Membres
104 658
dernier inscrit
amomo