Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting a value in a cell using VBA

Status
Not open for further replies.

pryest

Programmer
Dec 26, 2006
24
0
0
US
I am sure this is a simple problem to solve. I am just not sure the what would be the best way. I have a Excel worksheet that is being used as a survey. Each question has a Cell with a Yes/No drop down list. For each question I have a cell for comments under it. When the User selects No for a question. I would like to have a Message show in the "comment" cell to remind the user to supply comments. How could I do this using VBA? I am just learning VBA and don't know the specific commands to use in Excel to make this work. Thanks.

Mike
 


Hi,

Where is the Yes/No Column? Please describe what would happen in painful detail. Please be CLEAR, CONCISE & COMPLETE.

Based on a Worksheet_Change event, selecting one of those values can trigger a procedure.

Right click the sheet tab and select View Code

This is the Code Window for this Sheet Object.



Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Right click on the sheet tab and select "View Code".

Paste the following into the window:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target = "no" Then
    MsgBox "Please enter a comment"
End If
End Sub

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top