Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
If Cells(Target.Row, 1) >= 1 Then
Cells(Target.Row, 1).AddComment
Cells(Target.Row, 1).Comment.Visible = False
Cells(Target.Row, 1).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 2 Then
If Cells(Target.Row, 2) >= 1 Then
Cells(Target.Row, 2).AddComment
Cells(Target.Row, 2).Comment.Visible = False
Cells(Target.Row, 2).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 3 Then
If Cells(Target.Row, 3) >= 1 Then
Cells(Target.Row, 3).AddComment
Cells(Target.Row, 3).Comment.Visible = False
Cells(Target.Row, 3).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 4 Then
If Cells(Target.Row, 4) >= 1 Then
Cells(Target.Row, 4).AddComment
Cells(Target.Row, 4).Comment.Visible = False
Cells(Target.Row, 4).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 5 Then
If Cells(Target.Row, 5) >= 1 Then
Cells(Target.Row, 5).AddComment
Cells(Target.Row, 5).Comment.Visible = False
Cells(Target.Row, 5).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 6 Then
If Cells(Target.Row, 6) >= 1 Then
Cells(Target.Row, 6).AddComment
Cells(Target.Row, 6).Comment.Visible = False
Cells(Target.Row, 6).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 7 Then
If Cells(Target.Row, 7) >= 1 Then
Cells(Target.Row, 7).AddComment
Cells(Target.Row, 7).Comment.Visible = False
Cells(Target.Row, 7).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 8 Then
If Cells(Target.Row, 8) >= 1 Then
Cells(Target.Row, 8).AddComment
Cells(Target.Row, 8).Comment.Visible = False
Cells(Target.Row, 8).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 9 Then
If Cells(Target.Row, 9) >= 1 Then
Cells(Target.Row, 9).AddComment
Cells(Target.Row, 9).Comment.Visible = False
Cells(Target.Row, 9).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 10 Then
If Cells(Target.Row, 10) >= 1 Then
Cells(Target.Row, 10).AddComment
Cells(Target.Row, 10).Comment.Visible = False
Cells(Target.Row, 10).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 11 Then
If Cells(Target.Row, 11) >= 1 Then
Cells(Target.Row, 11).AddComment
Cells(Target.Row, 11).Comment.Visible = False
Cells(Target.Row, 11).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
If Target.Column = 12 Then
If Cells(Target.Row, 12) >= 1 Then
Cells(Target.Row, 12).AddComment
Cells(Target.Row, 12).Comment.Visible = False
Cells(Target.Row, 12).Comment.Text Text:=Format(Now(), "dd.mm.yyyy" & ", " & "hh:mm")
End If
End If
End Sub
und so weiter und so weiter bis Spalte 25
Kann man das nicht vereinfachen?
Wie muß der Code aussehen.
Für den Blattschutz habe ich jetzt eine andere Möglichkeit gefunden, das Objekte bearbeitet werden können, macht mich zwar nicht glücklich, da dort auch Bottuns sind, die nicht gelöscht werden sollten.
Vielen Dank für Eure Hilfe
Gruß aus Muc