Bonsoir a tous , voila j'ai un fichier avec ,Nom Prénom etc , j'ai des MFC pour les doublons et cette macro , mais voila mon fichier est très long a reagir a chaque saisi , peut on simplifier ma macro je pense que c'est ça qui ralenti .
Merci
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cel As Range
If Not Intersect(Target, [B2:B2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [B2:B2000]).Cells
cel = UCase(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [F2:F2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [F2:F2000]).Cells
cel = UCase(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [C2:C2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [C2:C2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [G2:G2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [G2:G2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [H2:H2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [H2:H2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [I2:I2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [I2:I2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [J2:J2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [J2:J2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect([P2:R2000], Target) Is Nothing And Target.Count = 1 Then
If Target <> "" Then
Application.EnableEvents = False
valsaisie = Target
Application.Undo
If Left(Target.Formula, 1) = "=" Then
Target.Formula = Target.Formula & "+" & valsaisie
Else
Target.Formula = "=" & valsaisie
End If
Application.EnableEvents = True
End If
End If
End Sub
Merci
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cel As Range
If Not Intersect(Target, [B2:B2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [B2:B2000]).Cells
cel = UCase(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [F2:F2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [F2:F2000]).Cells
cel = UCase(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [C2:C2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [C2:C2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [G2:G2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [G2:G2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [H2:H2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [H2:H2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [I2:I2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [I2:I2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect(Target, [J2:J2000]) Is Nothing Then
Application.EnableEvents = False
For Each cel In Intersect(Target, [J2:J2000]).Cells
cel = WorksheetFunction.Proper(cel)
Next cel
Application.EnableEvents = True
End If
If Not Intersect([P2:R2000], Target) Is Nothing And Target.Count = 1 Then
If Target <> "" Then
Application.EnableEvents = False
valsaisie = Target
Application.Undo
If Left(Target.Formula, 1) = "=" Then
Target.Formula = Target.Formula & "+" & valsaisie
Else
Target.Formula = "=" & valsaisie
End If
Application.EnableEvents = True
End If
End If
End Sub