AW: Mehrere markierte Zellinhalte in EINEN Kommentar
17.08.2017 12:59:14
ChrisL
Hi Dieter
Einen Kommentar als Tabelle formatieren geht natürlich nicht, aber probiere mal...
Sub t()
Dim c As Range, s As String, r As Long, x As String, ar As Variant
With Range("A1")
If Not .Comment Is Nothing Then .Comment.Delete
.AddComment
.Comment.Visible = True
If Selection.Cells.Count = 1 Then
s = Selection
ElseIf Selection.Columns.Count = 1 Then
s = Join(Application.Transpose(Selection), Chr(10))
Else
For r = Selection.Row To Selection.Row + Selection.Rows.Count - 1
ar = Application.Transpose(Range(Cells(r, Selection.Column), _
Cells(r, Selection.Column + Selection.Columns.Count - 1)).Value)
x = Join(Application.Transpose(ar), ";")
s = IIf(s = "", x, s & Chr(10) & x)
Next r
End If
.Comment.Text Text:=s
End With
End Sub
cu
Chris