LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 184
Default Data Validation List from a Dynamic Named Range on Another Workshe

Hello all. I have searched all over the web for an answer to this question
and I've come to the conclusion that there is either a problem with the way
I've built my dynamic named range or I'm a complete moron.

I have two worksheets. The first is where the data will be used and viewed,
the second is where the lists reside that the data validation draws from. I
have no problem getting the first level of data validation to work (ie,
select the cell, Data Validation, Allow List, Source =OFFSET(Parks,1,0)
because I have a header). The problem occurs when I try to validate another
cell based on the first cells validation answer.

The formula I'm using on the second worksheet, called "Lists" is...
=OFFSET(Lists!$C$1,0,0,MATCH("*",Lists!$C:$C,-1),1)
Obviously this is in column C and I want it to expand as values are added to
it. Now I need to mention that I also have some VBA associated with each list
that automatically alphabetizes the range when a new value is added. The VBA
code is...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("Parks").Sort key1:=Range("Parks"), Order1:=xlAscending, _
Header:=xlYes, MatchCase:=False
End Sub

What I need to accomplish, is once I select a value from the first drop
down, I need the values offered in another drop down (in the same row but a
different column) to update based on the first cell. I know INDIRECT won't
work and I've tried OFFSET but can't get any of them to give me a drop down
list. I will also be adding more VBA to the first sheet (without the lists)
that lets me populate the cell with dependent data validation with multiple
values per cell...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String
Dim newVal As String
If Target.Count 1 Then GoTo exitHandler

On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler

If rngDV Is Nothing Then GoTo exitHandler

If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If Target.Cells = Range("D6") Then
If oldVal = "" Then
'do nothing
Else
If newVal = "" Then
'do nothing
Else
Target.Value = oldVal _
& ", " & newVal
End If
End If
End If
End If

exitHandler:
Application.EnableEvents = True
End Sub

Now this is the very first time I have ever "coded" VBA (actually borrowed
and modified code) so be gentle. Any help or advice will be greatly
appreciated. Thanks!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Validation via Dependent List defined by Dynamic Range Lee4 Excel Discussion (Misc queries) 3 August 20th 08 04:45 PM
Changing named Validation list to Dynamic list. GlenC Excel Discussion (Misc queries) 1 July 20th 06 11:49 PM
Data validation drop downs don't recognize dynamic named range GlenC Excel Discussion (Misc queries) 0 July 19th 06 06:25 PM
Using a data validation list to look up a defined named range in another worksheet Laura Hunt Charts and Charting in Excel 0 November 24th 05 02:29 PM
named range, data validation: list non-selected items, and new added items KR Excel Discussion (Misc queries) 1 June 24th 05 05:21 AM


All times are GMT +1. The time now is 09:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"