Clic-droit pour la saisie
Private Sub b_ok_Click()
n = 5
Dim pos(), lg()
ReDim pos(n), lg(n)
poscourant = 1
For i = 1 To n
temp = temp & Me("label" & i) & ":" & Me("textbox" & i) & vbLf
pos(i) = poscourant
poscourant = poscourant + Len(Me("label" & i)) + Len(Me("textbox" & i)) + 2
lg(i) = Len(Me("label" & i))
Next i
With ActiveCell
If Not .Comment Is Nothing Then .Comment.Delete
.AddComment
.Comment.Text Text:=temp
For i = 1 To n
.Comment.Shape.TextFrame.Characters(Start:=pos(i), Length:=lg(i)).Font.Bold = True
Next i
.Comment.Visible = True
.Comment.Shape.TextFrame.AutoSize = True
.Comment.Visible = False
End With
Unload Me
End Sub
Private Sub UserForm_Initialize()
If Not ActiveCell.Comment Is Nothing Then
temp = ActiveCell.Comment.Text
a = Split(temp, vbLf)
For i = LBound(a) To UBound(a)
p = InStr(a(i), ":")
If p > 0 Then Me("textbox" & i + 1) = Mid(a(i), p + 1)
Next i
End If
Me.Left = 300
Me.Top = 100
End Sub