View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre Ron Coderre is offline
external usenet poster
 
Posts: 2,118
Default Automatic Update of Dropdown List Box data

To do what you're asking, you'll need a bit of VBA code.

Try this:

Select the sheet with the Data Validation
Right-Click on the sheet tab
Select: View Code.....(that will open the VBA editor)

Paste this code into the VBA editor:
'--------start of code----------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngParentCell As Range
Dim rngDepCell As Range
Dim rngCell As Range

Set rngParentCell = Range("A1")
Set rngDepCell = Intersect(Target, rngParentCell)

If Not rngDepCell Is Nothing Then
Set rngCell = Range("A2")
rngCell.ClearContents
rngCell.Select
MsgBox _
Title:="Notice", _
Prompt:="You must now select an item from cell A2", _
Buttons:=vbInformation + vbOKOnly
Application.SendKeys ("%{DOWN}")

End If

Set rngParentCell = Nothing
Set rngDepCell = Nothing
Set rngCell = Nothing

End Sub
'--------end of code----------

Now try changing the A1 value.
The message should pop up.
After the user clicks [OK]...A2 will be selected and the list displayed.

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Rajat" wrote:

In cell A1 i have created a "Drop Down list " using validation which calls
data from B1:B4.
and in A2 i have created a "drop Down List" using validation which Calls
data from D1:D4.
And B1 , B2, B3, B4 contains data Like 1, 2, 3, 4 respectively.
C1 = A1 cell data
then in D1 : D4 cell i have used vlookup function to create a dynamic list
i.e. if in C1 data is = 1 the D1:D4 shows 1.1, 1.2, 1.4, 1.4 respectively and
if in C1 data is = 2 the D1:D4 shows 2.1, 2.2, 2.4, 2.4 respectively
Which then shows up in the list box of A2.
The problem i face is say first i selected 1 in cell A1 and the list Box of
A2 shows (1.1, 1.2, 1.4, 1.4) and i selected 1.2 but later on i chaged A1
cell value to 2 but but subsequently D1:D4 value chaged to 2.1, 2.2, 2.4, 2.4
respectively but as i entered data in A2 didn't chaged.

what i want is if i chaged data in A1 then the the cell A2 value to be made
"" (Blank) and a alert message to provide to select data in A2.