Macro/VBA to insert a comment mandatory when selecting a dropdown option

ussy1995

New Member
Joined
Sep 10, 2019
Messages
2
Is there a macro or vba code i can use so that when cell C6 dropdown is selected, a message box appears for the user to insert a comment mandatory?

I would like to use this for multiple cells i.e. cell C6 dropdown 'Resource' is selected, message box appears saying 'Insert Comment'...user inserts comment and clicks OK...the cell now has a comment attached to it. Doing the same for Cell C7, Cell D14 etc.

thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Code below prevents user modifying cell until a comment has been added
- cell A1 is activated if comment left blank

Put code in SHEET module (does not work in standard module)
- rightClick sheetTab \ viewCode \ paste code into the window which opens \ go back to Excel with {ALT}{F11}
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim msg As String, T As String
    T = Target.Address(0, 0)
    Select Case T
        Case "C6", "C7", "D14"
            msg = InputBox("enter comment for " & T)
            If Len(msg) > 0 Then
                On Error Resume Next
                Target.Comment.Delete
                On Error GoTo 0
                Target.AddComment msg
            Else
                Range("A1").Select
            End If
        End Select
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top