Bonjour le forum,
J'ai un petit soucis de code ci-dessous....
la deuxième partie du code avec le target ne fonctionne pas
Je vous remercie pour votre aide
Belle journée
Tdenis
	
	
	
	
	
		
	
		
			
		
		
	
				
			J'ai un petit soucis de code ci-dessous....
la deuxième partie du code avec le target ne fonctionne pas
Je vous remercie pour votre aide
Belle journée
Tdenis
		VB:
	
	
	Private Sub Devis_Accepte()
Dim Target As Range
Dim FeuillePrecedente As String
FeuillePrecedente = ActiveSheet.Name
Dim Ref_Val, Cellule_en_Cours As Range 'définition des variables, un variant, un range
    On Error GoTo Gere_Erreurs 'si erreur va à Gere_Erreurs
    With ActiveSheet.Tab
        .ThemeColor = xlThemeColorAccent6
        .TintAndShade = 0
        End With
        Sheets("Recap Dev.Fac").Select
                  Rows("2").Select
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Application.EnableEvents = True
    Range(Cells(2, 1), Cells(2, 6)).Interior.ColorIndex = 34
    Range("A2").Select
    ActiveCell.Formula2R1C1 = Sheets(FeuillePrecedente).Range("K1").Value
    Range("B2").Select
    ActiveCell.Formula2R1C1 = Sheets(FeuillePrecedente).Range("B16").Value
    Range("C2").Select
    ActiveCell.Formula2R1C1 = Sheets(FeuillePrecedente).Range("F4").Value
    Range("D2").Select
    ActiveCell.Formula2R1C1 = Sheets(FeuillePrecedente).Range("F5").Value
    With Selection
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = True
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Range("E2").Select
    ActiveCell.Formula2R1C1 = Sheets(FeuillePrecedente).Range("F9").Value
    Selection.NumberFormat = "0#"".""##"".""##"".""##"".""##"
    Range("F2").Select
    ActiveCell.Formula2R1C1 = Sheets(FeuillePrecedente).Range("F10").Value
    With Selection
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = True
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
            Rows("2").Select
               lrow = Selection.Row()
        Rows(lrow).Select
        Selection.Copy
        Rows(lrow + 1).Select
        Selection.Insert Shift:=xlDown
        Application.CutCopyMode = False
        Selection.ClearContents
        Range(Cells(3, 1), Cells(3, 6)).Interior.ColorIndex = 0
    Sheets(FeuillePrecedente).Select
    If Not Intersect(Target, Range(Cells(16, 3), Cells(45, 4))) Is Nothing Then
        Application.EnableEvents = False
        For Each Cellule_en_Cours In Target(Range(Cells(16, 3), Cells(45, 4))) 'pour chaque cellule de l'intersection
            With Cellule_en_Cours 'avec la cellule en cours
                Select Case .Value 'selon la valeur de la cellule en cours
                Case Is = "Materiaux" 'exécute le code jusqu'au prochaine case si cellule en cours = valeur puis va à end select
                  Sheets("Recap Dev.Fac").Select
                    Rows("3").Select
                    Selection.Insert Shift:=xlUp, CopyOrigin:=xlFormatFromLeftOrAbove
                    Application.EnableEvents = True
                    Range("A3").Select
                    ActiveCell.Formula2R1C1 = Sheets(FeuillePrecedente).Range("D17").Value
                    Range("D3").Select
                    ActiveCell.Formula2R1C1 = Sheets(FeuillePrecedente).Range("H17").Value
                 End Select
            End With
        Next Cellule_en_Cours
        End If
    
Sheets(FeuillePrecedente).Select
On Error GoTo 0
Gere_Erreurs:
    Application.EnableEvents = True
    
End Sub