1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Private ou As Range, agir As Boolean
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then agir = False
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If agir Then ou.Value = TextBox1.Text
With TextBox1
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width
.Height = Target.Height
.Font.Size = Target.Font.Size
.BorderStyle = fmBorderStyleNone
.SpecialEffect = fmSpecialEffectFlat
.Text = Target.Value
.Activate
End With
agir = True
Set ou = Target
End Sub |
Partager