Retour en arriere

Salut,

Je cherche un moyen de revenir en arriere dans le code suivant, au niveau de la saisie de ma inputbox REP2, et je sais pas trop comment m'y prendre

Rep = MsgBoxPerso(MonMessage1, "", vbQuestion, "R", "PP", True)
    Select Case Rep
        Case 0 ' ici le traitement (éventuel) si Annulation
        MsgBox "Génération en manuel"
        Exit Sub

        Case 1 ' ici le traitement si réponse= "R"
        Rep2 = InputBox("N° de banc file 1")

        'test fichier
            If Dir("S:\" & Rep2 & ".xlsm") = "" Then
            MsgBox ("Fichier inexistant")

            ''''''''''''''''''''''''
            ' retourné a la saisie de Rep2
            ''''''''''''''''''''''''         
            Else
            Range("H4").Value = Rep2
            End If

Bonjour

Attention non testé

Mais bouclera tant que le fichier sera inexistant

Sub test()
  Rep = MsgBoxPerso(MonMessage1, "", vbQuestion, "R", "PP", True)
  Select Case Rep
    Case 0 ' ici le traitement (éventuel) si Annulation
      MsgBox "Génération en manuel"
      Exit Sub

    Case 1 ' ici le traitement si réponse= "R"
      Do
        Rep2 = InputBox("N° de banc file 1")
        'test fichier
        If Dir("S:\" & Rep2 & ".xlsm") = "" Then
          MsgBox ("Fichier inexistant")
        Else
          Range("H4").Value = Rep2
          Exit Do
        End If
        ''''''''''''''''''''''''
        ' retourné a la saisie de Rep2
        ''''''''''''''''''''''''
      Loop
  End Select
End Sub
Rechercher des sujets similaires à "retour arriere"