mit meinem Makro schreibe ich, in diesem Fall TU, in jede markierte Zelle.
Dazu der Kommentar wer und wann.
Den Kommentar fügt das Makro aber nur in die Aktive Zelle. (So wie geschrieben)
Ich möchte aber das der Kommentar ebenfalls in jede markierte Zelle geschrieben wird.
Komme aber nicht dahinter.
Hoffe einer von euch hat eine Idee
Gruß Micha
Sub TU()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="123"
Dim x As Object
Dim eingabe As String
eingabe = "TU"
For Each x In Selection
x.Value = eingabe
Next x
Selection.Font.Name = "Arial"
Selection.Font.Bold = True
Selection.Font.Size = 10
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 1841145
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.Color = -16777216
.TintAndShade = 0
End With
Dim strComment As String
With ActiveCell
If .Comment Is Nothing Then
strComment = TextBox1
.AddComment
With .Comment
.Text Text:=Application.UserName & ":" & Chr(10) & Format(Now, "DD" & "." & "MM" & "." & _
_
_
"YY") & strComment
.Shape.TextFrame.AutoSize = True
End With
Else
.Comment.Text Text:=.Comment.Text & Chr(10) & Application.UserName & Chr(10) & Format(Now, " _
_
_
DD" & "." & "MM" & "." & "YY") & strComment
End If
End With
ActiveSheet.Protect Password:="123" ', UserInterfaceOnly:=True, DrawingObjects:=False, Contents: _
_
_
=True, Scenarios:=False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub