Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
excel drop down box used conditionally based on previous input
I want a cell to have a drop down box to select from only when a prior cell
entry is true. Otherwise the cell will be blank, no drop down box, waiting for the users input. I appreciate the assistance. Regards, RGS |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
excel drop down box used conditionally based on previous input
Hi,
You would probably need to do that with VBA triggered by an Change event: Here is some sample code: Private Sub Worksheet_Change(ByVal Target As Range) Dim isect As Range Set isect = Application.Intersect(Target, Range("A1:A10")) If Not isect Is Nothing Then 'Your code he If target = True Then Range("F1").Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=mylist" .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .IgnoreBlank = True .InCellDropdown = True .ShowInput = True .ShowError = True End With End If End If End Sub Here the A1:A10 is the trigger cell, meaning the one that determines whether there will be data validation or not in you other cell. Record the adding of the data validation and the removing of the data validiation and stick them in above. I have put in a quick sample. 1. To add this code to your file, press Alt+F11, 2. In the VBAProject window, top left side, find your sheet name under your file name and double click it. 3. Paste in or type the code above. -- If this helps, please click the Yes button. Cheers, Shane Devenshire "RGS" wrote: I want a cell to have a drop down box to select from only when a prior cell entry is true. Otherwise the cell will be blank, no drop down box, waiting for the users input. I appreciate the assistance. Regards, RGS |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving without deleting previous input | Excel Worksheet Functions | |||
auto populate cell based on previous cell drop down list selectio. | Excel Discussion (Misc queries) | |||
create 3 drop down menus in Excel, each relating to previous | Excel Worksheet Functions | |||
Lock and unlock cells conditionally depending on input in another | Excel Worksheet Functions | |||
How do I add input data in the input ranges in drop down boxes. | Excel Discussion (Misc queries) |