Bonjour,
Dans le code de mon ScrollBar1_Change j'aimerais pouvoir arrêter la procédure du code si bouton sur OF et continuer la procédure si bouton sur ON.
Mais je ne sais pas comment finaliser le code
Code du bouton
	
	
	
	
	
		
Code pour le ScrollBar1
	
	
	
	
	
		
Merci pour votre aide.
	
		
			
		
		
	
				
			Dans le code de mon ScrollBar1_Change j'aimerais pouvoir arrêter la procédure du code si bouton sur OF et continuer la procédure si bouton sur ON.
Mais je ne sais pas comment finaliser le code
Code du bouton
		VB:
	
	
	Private Sub CommandButton6_Click()
With CommandButton6
  If .Caption Like "*ON" Then
  CommandButton6.BackColor = RGB(255, 0, 0)
    arret = True
    .Caption = "OF"
  Else
  CommandButton6.BackColor = RGB(0, 255, 0)
    arret = False
    .Caption = "ON"
  End If
End With
End SubCode pour le ScrollBar1
		Code:
	
	
	Private Sub ScrollBar1_Change()
Dim Chemin As String, Ligne As Integer, img As Object
    Ligne = ScrollBar1.Value
    Set img = WebBrowser1.Document.getelementsbytagname("img")(0)
    TextBox1 = ActiveSheet.Range("E" & Ligne)
    TextBox2 = ActiveSheet.Range("Q" & Ligne)
    TextBox2.BackColor = ActiveSheet.Range("Q" & Ligne).DisplayFormat.Interior.Color
    TextBox3 = ActiveSheet.Range("J" & Ligne)
    TextBox3.BackColor = ActiveSheet.Range("V" & Ligne).DisplayFormat.Interior.Color
    TextBox4 = ActiveSheet.Range("N" & Ligne)
    TextBox4.BackColor = ActiveSheet.Range("N" & Ligne).DisplayFormat.Interior.Color
    
        
    Chemin = "C:\Users\franck.delaunay\Documents\Thierry\Data systems\" & Cells(Ligne, 6) & ".jpg"
    img.src = ""
    If Dir(Chemin) <> "" Then
        img.src = Chemin
    End If
    
    With CommandButton6 ' Si bouton sur OF on revient au début
    arret = False       ' Si bouton sur ON on continue
    End With
    
    
    With UserForm10
    .Width = 800
    End With
    Cells.Find(What:=TextBox1.Value, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
        , SearchFormat:=False).Activate
    Sheets("Usinage").Select
    Cells.FindNext(After:=ActiveCell).Activate
Dim lig&, commentaire As Comment
lig = ActiveCell.Row
    TextBox7.Text = ActiveCell.Value
UserForm10.TextBox7.BackColor = ActiveCell.DisplayFormat.Interior.Color
UserForm10.TextBox8.Text = Range("AO" & lig).Value
UserForm10.TextBox8.BackColor = Range("AO" & lig).DisplayFormat.Interior.Color
UserForm10.TextBox9.Text = Range("AP" & lig).Value
UserForm10.TextBox9.BackColor = Range("AP" & lig).DisplayFormat.Interior.Color
Sheets("Base").Select
With CommandButton6
    arret = True
    End With
End SubMerci pour votre aide.
 
	 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		