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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompt for additional data in excel

Status
Not open for further replies.

laurabro

Technical User
May 28, 2003
2
GB
Please can smeone tell me how I prompt someone for information in a cell based on an entry in another cell?

eg. In A1, I have a yes/no question - if I enter yes, I want excel to prompt for a value to be entered in B1. A negative response would require no action.
 

Use data validation on column A and set it to "List"
and type YES,NO in the source box.

Then this code in the worksheet change event.

Private Sub Worksheet_Change(ByVal Target As Range)

If ActiveCell.Column <> 1 Then
Exit Sub
Else

If UCase(ActiveCell.Value) = &quot;YES&quot; Then Cells(ActiveCell.Row, 2) = &quot;NO&quot; 'change 2 to your col ref
End If

End Sub
 
Oh ...sorry

change the last line in the sub to this


If UCase(ActiveCell.Value) = &quot;YES&quot; Then Cells(ActiveCell.Row, 2).Select: ActiveCell.Value = InputBox(&quot;Value for Col B&quot;)
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top