Comment enlever le nom d'utilisateur par défaut quand on rajoute un commentaire ?

anthoYS

XLDnaute Barbatruc
Bonjour,

voilà tout est dans le titre.
j'ai chaque fois "Anthony" (en gras donc... Pouah c'est gavant quoi !)

Merci !!
 

Lone-wolf

XLDnaute Barbatruc
Re : Comment enlever le nom d'utilisateur par défaut quand on rajoute un commentaire

Bonsoir Anthony

Bah... met Delon à la place ou mieux encore Queen ;)

Trève de plaisenterie essaie comme ceci

Code:
With Range("A1")
.Comment.Visible = True
 .Comment.Text Text:="C'est qui par Tutatis?!"
 .Comment.Shape.TextFrame.AutoSize = True
End With
 
Dernière édition:

Lone-wolf

XLDnaute Barbatruc
Re : Comment enlever le nom d'utilisateur par défaut quand on rajoute un commentaire

Bonsoir gosselien :)

@Anthony: oubien (toujours si commentaire existe déjà)

Code:
With Range("A1")
    .Comment.Visible = True
   .Comment.Text Text:=Replace(.Comment.Text, Application.UserName  _
    & ":" & Chr(10), "C'est qui Tutatis?!")
   .Comment.Shape.TextFrame.AutoSize = True
   End With
 

Lone-wolf

XLDnaute Barbatruc
Re : Comment enlever le nom d'utilisateur par défaut quand on rajoute un commentaire

Re

dans la même lancée

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    With Range("d5")
    .Comment.Visible = True
   .Comment.Text Text:=Replace(.Comment.Text, "C'est qui par Tutatis?!", _
 "C'est qui Tutatis?!")
   .Comment.Shape.TextFrame.AutoSize = True
   End With
Cancel = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Range("d5")
    .Comment.Visible = True
    .Comment.Text Text:="C'est qui par Tutatis?!"
    End With
   End Sub
 

anthoYS

XLDnaute Barbatruc
Re : Comment enlever le nom d'utilisateur par défaut quand on rajoute un commentaire

Re,

Merci. Comment ajouter un commentaire par double clic sans username en A, si je double clique en A2 par exemple, je dois avoir un commentaire actif vierge près à être saisi... avec une taille de cadre prédéfini... Et idem en E mais avec des dimensions prédéfinis aussi différente de A ?

vous pouvez m'aider svp.

merci !!
 

Lone-wolf

XLDnaute Barbatruc
Re : Comment enlever le nom d'utilisateur par défaut quand on rajoute un commentaire

Re

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  With Range("a2")
  .AddComment
   .Comment.Text Text:=""
    .Comment.Shape.Width = 100  ' Largeur
    .Comment.Shape.Height = 45   'Hauteur
   End With

With Range("e5")
  .AddComment
   .Comment.Text Text:=""
    .Comment.Shape.Width = 80  ' Largeur
    .Comment.Shape.Height = 35   'Hauteur
   End With
End Sub
 
Dernière édition:

anthoYS

XLDnaute Barbatruc
Re : Comment enlever le nom d'utilisateur par défaut quand on rajoute un commentaire

Re

Code VBA:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With Range("a2")
.AddComment
.Comment.Text Text:=""
.Comment.Shape.Width = 100 ' Largeur
.Comment.Shape.Height = 45 'Hauteur
End With

With Range("b5")
.AddComment
.Comment.Text Text:=""
.Comment.Shape.Width = 80 ' Largeur
.Comment.Shape.Height = 35 'Hauteur
End With
End Sub

Merci beaucoup. C'est presque ça. Pas seulement en A2, mais quelque soit le double clic en A. Et idem en E pas B.
 

Lone-wolf

XLDnaute Barbatruc
Re : Comment enlever le nom d'utilisateur par défaut quand on rajoute un commentaire

Re Anthony


Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("a2:a100")) Is Nothing Then
With ActiveCell
.AddComment
.Comment.Text Text:=""
.Comment.Shape.Width = 100 ' Largeur
.Comment.Shape.Height = 45 'Hauteur
End With
End If

If Not Intersect(Target, Range("e2:e100")) Is Nothing Then
With ActiveCell
.AddComment
.Comment.Text Text:=""
.Comment.Shape.Width = 80 ' Largeur
.Comment.Shape.Height = 30 'Hauteur
End With
End If
End Sub
 

Discussions similaires

Statistiques des forums

Discussions
312 176
Messages
2 085 963
Membres
103 068
dernier inscrit
Strogoff