Excel/VBA - An Event that will prompt for comments

December 2016


I am trying to create an event within multiple cells that would ask for a comment if certain conditions are met.
For instance:
  • If c1 < 3.2 then [run event]
  • I want the event to take the forms a comment popup that would save to a comment on the cell.


Try this:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyMessage As String
If Intersect(Target, Range("C1")) Is Nothing Then Exit Sub
If Range("C1") < 3.2 Then
MyMessage = InputBox("Please input your comment")
With Range("C1")
    .Comment.Visible = False
    .Comment.Text Text:=MyMessage
End With
End If
End Sub

Thanks to TrowaD for this tip.

Related :

This document entitled « Excel/VBA - An Event that will prompt for comments » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.