Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'efface espaces numéros et copie texte dans même cellule par Hervé62
If Not Application.Intersect(Target, Range("e7:e16")) Is Nothing Then
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:=""
On Error Resume Next
With Target
ActiveSheet.PasteSpecial Format:="Texte", Link:=False, DisplayAsIcon:=False
Call ClearClipboard
ActiveCell.Offset(0, 1).Select
End With
If IsNumeric(Target) Then
ActiveCell.Offset(0, -1).Select
Selection.Copy
ActiveCell.Offset(0, 4).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Copy
ActiveCell.Offset(0, -4).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Target = Range("e3") & Target
If [Target] > 1 And [Target] < 100000000000# Then
ActiveCell.Offset(0, 1).Select
Else
MsgBox "Erreur : vous n'avez pas copié 9 chiffres !", , "Oups"
' Range("H1").Select
' ActiveCell.FormulaR1C1 = "2 clics"
Target = ""
Target.Offset(0, 4) = ""
Application.CutCopyMode = False
Application.EnableEvents = True
ActiveSheet.Protect Password:="", DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoRestrictions
Exit Sub
End If
End If
End If
ActiveSheet.Protect Password:="", DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoRestrictions
Application.EnableEvents = True
Application.ScreenUpdating = True