Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Dim cell As Range, Refcel, Plg, UnionPlg
If Sh.Name = "Liste" Then
If Target <> Range("A1") Then
If Left(Target.Value, 1) = "$" Then
Selection.Interior.ColorIndex = 33
Else
Target.Interior.ColorIndex = xlNone
MsgBox "Vous devez cliquer une adresse ! Sinon choisissez une autre feuille ! ", , "Pour mettre un doublon en couleur dans la feuille d'origine."
End If
End If
If Target = Range("A1") Then
For Each cell In Range("A1").CurrentRegion
If cell.Interior.ColorIndex = 33 Then
'If Len(cell) > 4 Then
'Refcel = Mid(cell, 2, 1) & Mid(cell, 4, Len(cell) - 2)
' Else
' Refcel = Mid(cell, 2, 1) & Mid(cell, 4, 2)
'End If
Refcel = Application.WorksheetFunction.Substitute(cell, "$", "")
Plg = Plg & Refcel & ","
End If
Next
If Plg = "" Then MsgBox "Aucune adresse de cellule sélectionnée !", vbCritical, "Attention:": Exit Sub
UnionPlg = Left(Plg, Len(Plg) - 1)
Sheets(Range("A1").Value).Range(UnionPlg).Interior.ColorIndex = 33
Sheets(Range("A1").Value).Activate
End If
Application.EnableEvents = True ' Remise en place de l'intercepteur d'évènement
End If
End Sub