Makro in Private Sub integrieren?
06.02.2019 19:46:03
David
ich möchte 2 Formeln verbinden, weiss aber nicht wie.
Einmal bestimme ich hiermit die Position eines Kommentarfeldes:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim cmt As Comment
Application.DisplayCommentIndicator = xlCommentIndicatorOnly
Set cmt = ActiveCell.Comment
If Not cmt Is Nothing Then
With ActiveWindow.VisibleRange
cmt.Shape.Width = 100
cmt.Shape.Top = cmt.Parent.Top - 150
cmt.Shape.Left = .Left + 200
cmt.Visible = True
End With
End If
End Sub
Ich wollte nun noch die Höhe automatisch anpassen, was sich wohl als sehr schwierig heraus gestellt hat. Hier hat jemand eine Lösung gefunden indem er die Höhe von der Anazhl der Zeichen abhängig macht, jedoch als Macro.
Ich hätte gerne dieses Makro im Code oben integriert.
Sub ResetCommets2()
Dim ct As Integer, ht As Integer
Dim cmt As Comment
For Each cmt In ActiveSheet.Comments
ct = cmt.Shape.TextFrame.Characters.Count
cmt.Shape.Top = cmt.Parent.Top + 5
cmt.Shape.Left = _
cmt.Parent.Offset(0, 1).Left + 5
cmt.Shape.Width = 100
If ct = 30 And ct
Ich denke das müsste doch möglich sein?Vielen Dank schonmal
David