1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Count = 1 And Target.Column >= 1 And Target.Column <= 3 Then
Call RamenerUnMotDepuisLaDroite(Target)
Cancel = True
End If
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Target.Count = 1 And Target.Column >= 1 And Target.Column <= 3 Then
Call DeplacerUnMotVersLaDroite(Target)
Cancel = True
End If
End Sub
Private Sub DeplacerUnMotVersLaDroite(c As Range)
Dim t As Variant
t = Split(c.Text, " ")
If UBound(t) >= 0 Then
t = t(UBound(t))
c.Value = Trim(Replace(c.Text, t, ""))
c.Offset(0, 1).Value = Trim(t & " " & c.Offset(0, 1).Text)
End If
End Sub
Private Sub RamenerUnMotDepuisLaDroite(c As Range)
Dim t As Variant
t = Split(c.Offset(0, 1).Text, " ")
If UBound(t) >= 0 Then
t = t(0)
c.Offset(0, 1).Value = Trim(Replace(c.Offset(0, 1).Text, t, ""))
c.Value = Trim(c.Text & " " & t)
End If
End Sub |
Partager