View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach[_2_] Otto Moehrbach[_2_] is offline
external usenet poster
 
Posts: 1,071
Default Excel -- Data Validation -- Create Dependent Lists

Louisa
You have a data validation cell with choices of Yes and No. Is that
right? You want that cell to display N/A if the user selects No. Is that
right? If this is right then, yes, you can do that but it will take VBA to
do it. The following macro will do that for you. I assumed that the data
validation cell is A1. Change that in the macro as needed. This is a sheet
macro and must be placed in the sheet module of that sheet. You access that
module by right-clicking on the sheet tab and selecting View Code. Paste
this macro into that module. "X" out of the module to return to your sheet.
When you set up the data validation in that cell, you must select to NOT
display an error message if a wrong value is entered. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Not Intersect(Target, Range("A1")) Is Nothing Then
If UCase(Target) = "NO" Then
Application.EnableEvents = False
Target = "N/A"
Application.EnableEvents = True
End If
End If
End Sub
"Louisa" wrote in message
...
Hi

Can you create an automatic default value if you choose one option from a
drop down list and a dependant list if you do not.

I have been to the following website
"http://www.contextures.com/xlDataVal02.html"and have managed to create
the
dependent lists and if I choose the yes answer then I get one list and if
I
choose no then I get another but what I can not seem to do is to get it to
default automatically to one value if I choose no ie.
I have a yes or no drop down and if you answer No then I want it to
automatically assign N/A but if yes is chosen then they need to choose
from
the applicable drop down list. At the moment you have to go into the cell
and
choose N/A when you pick a No answer

I hope someone get help me

Thanks

Louisa