Bonsoir à tous,
J'ai repris la démo loupe de Jacques Boisgontier.
Alors j'aimerais lors d'un clic sur une cellule réaliser un effet de loupe en deux temps :
1- Afficher en premier, un petit carré blanc au centre de la cellule active.
2- Puis afficher un grand carré (loupe) avec des dimensions qui entoure toute la cellule active avec le texte dedans.
Merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 Option Explicit Const KShCom = "CmtSh" Dim ShCom As Shape Private Sub CreeShape() On Error Resume Next ActiveSheet.Shapes(KShCom).Delete Set ShCom = ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 1, 1, ActiveCell.Width + 16, ActiveCell.Height + 16) With ShCom .DrawingObject.Font.Name = "Verdana" .DrawingObject.Font.Size = 13 .Name = KShCom .Left = ActiveCell.Left - 10 .Top = ActiveCell.Top - 10 End With End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error Resume Next With Target If .Count = 1 And Not Intersect(Target, [Rng]) Is Nothing Then If ShCom Is Nothing Then CreeShape If Not ShCom.Visible Then Exit Sub ShCom.Left = .Left - 10 ShCom.Top = .Top - 10 .Height = Target.Height + 16 .Width = Target.Width + 16 ShCom.DrawingObject.Text = .Text Else ShCom.Visible = msoFalse End If End With End Sub Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Count <> 1 Or Intersect(Target, [Rng]) Is Nothing Then Exit Sub If ShCom Is Nothing Then CreeShape With ShCom .Visible = Not .Visible If .Visible Then .Left = Target.Left - 10 .Top = Target.Top - 10 .Height = Target.Height + 16 .Width = Target.Width + 16 .DrawingObject.Text = Target.Text End If End With Cancel = True End Sub
EDIT :
Peut-être un petit éclairci le problème
Partager