Bonjour à toutes et à tous
Encore besoin de vous,
J'ai dans le le code de ma feuille 1 les macros suivantes :
Je voudrais désactiver ces deux macros pendant l'exécution d'une autre macro et j'ai fait cela dans mon module :
Evidemment LOL, ça ne marche pas.
Le message suivant s'affiche : Erreur de compilation - Non ambigu détecté : Worksheet_Change
Si vous pouviez m'aider, cela m'arrangerait grandement,
Vous m'avez tellement donné de solutions que je ne sais plus comment vous remercier.
Alors, simplement, je vous souhaite un très bon dimanche et je vous remercie de toutes mes forces.
Amicalement,
Lionel,
Encore besoin de vous,
J'ai dans le le code de ma feuille 1 les macros suivantes :
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect([E6:N1001], Target) Is Nothing Then
If Valeur <> "" Then
Application.EnableEvents = False
Target = Valeur
Application.EnableEvents = True
End If
End If
If Not Intersect([O6:BA1001], Target) Is Nothing Then
If Target = "" Then
Application.EnableEvents = False
Target = Valeur1
Application.EnableEvents = True
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect([E6:N1001], Target) Is Nothing Then
If Target.Count > 1 Then
Application.EnableEvents = False
ActiveCell.Select
Application.EnableEvents = True
End If
Valeur = ActiveCell.Value
End If
If Not Intersect([O6:BA1001], Target) Is Nothing Then
If Target.Count > 1 Then
Application.EnableEvents = False
ActiveCell.Select
Application.EnableEvents = True
End If
Valeur1 = ActiveCell.Value
End If
End Sub
Je voudrais désactiver ces deux macros pendant l'exécution d'une autre macro et j'ai fait cela dans mon module :
Code:
' EffTout Macro
'
'
Application.EnableEvents = False
Private Sub Worksheet_Change(ByVal Target As Range)
'ton code
Sheets("Base").Select
ActiveSheet.Unprotect
Range("E6:CZ1001").Select
Range("CZ1001").Activate
Selection.ClearContents
Range("A6:CZ1001").Select
ActiveWorkbook.Worksheets("Base").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Base").Sort.SortFields.Add Key:=Range("E6:E1001"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Base").Sort
.SetRange Range("A6:CZ1001")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("B6").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.EnableEvents = True
Private Sub Worksheet_Change(ByVal Target As Range)
'ton code
End Sub
Evidemment LOL, ça ne marche pas.
Le message suivant s'affiche : Erreur de compilation - Non ambigu détecté : Worksheet_Change
Si vous pouviez m'aider, cela m'arrangerait grandement,
Vous m'avez tellement donné de solutions que je ne sais plus comment vous remercier.
Alors, simplement, je vous souhaite un très bon dimanche et je vous remercie de toutes mes forces.
Amicalement,
Lionel,
Dernière édition: