Insérer par clic droit un commentaire dans une plage déterminer

anthoYS

XLDnaute Barbatruc
bonjour,

ce code permet d'insérer un commentaire si clic droit en F et en H par clic droit, or je les veux sur une plage determinée à savoir de C4 à AX26 soit [C4:AX26].

Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)Set Target = ActiveCell
Cancel = True
With Target
   If .Column = 6 Then
        Cancel = True
        If .Comment Is Nothing Then
            .AddComment
            .Comment.Shape.Width = 50.5
            .Comment.Shape.Height = 10.75
        End If
        SendKeys "%im"
    End If
    If .Column = 8 Then
        Cancel = True
        If .Comment Is Nothing Then
            .AddComment
            .Comment.Shape.Width = 110.5
            .Comment.Shape.Height = 15.75
        End If
        SendKeys "%im"
    End If
End With
End Sub


comment modifier le présent code de la feuille alors de la bonne sorte ?

merci par avance,
à+
 

STephane

XLDnaute Occasionnel
Re : Insérer par clic droit un commentaire dans une plage déterminer

A rajouter à la procédure proposée dans l'autre fil de discussion.
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)

If Intersect(Target, Range("C4:AX26")) Is Nothing Then Exit Sub

End Sub
 

Discussions similaires

Réponses
2
Affichages
142

Statistiques des forums

Discussions
312 232
Messages
2 086 462
Membres
103 222
dernier inscrit
2BS