+ Reply to Thread
Results 1 to 2 of 2

Dynamic Data Validation

Hybrid View

  1. #1
    Registered User
    Join Date
    11-19-2008
    Location
    Oxford, UK
    MS-Off Ver
    2003 (Work) / 2007 (Home)
    Posts
    60

    Dynamic Data Validation

    Hi,

    I am trying to use a VLOOKUP scenario for a data validation but I can't get it to work. I have looked at the Contextures information but cant decipher what I would like to do. In the contextures it shows all the lists as separate - can you not just amalgamate them?

    I would like the data validation list to be limited based upon another cell looking at a table. Is this possible?


    =OFFSET($G$2,0,1,MATCH($D$1,$G$2:$G$8,1),1)
    I am trying to return the values in column H:H where D1 matched column G.

    TIH
    Matthew
    Last edited by VBA Noob; 11-20-2008 at 08:47 AM.

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    re: Dynamic Data Validation

    I've used a small macro to do this. See my attachement. that will clear things up. Change D1 and/orE1. Vallist is a 'named' range.

    Good luck
    Sub ValList()
    
    Dim ValListStr As String
    Dim Ccell As Range
    
    For Each Ccell In Range("vallist").Resize(, 1) 'only left
      If Ccell = Range("D1") Then
        ValListStr = ValListStr & "," & Ccell.Offset(0, 1)
      End If
    Next
    With Selection.Validation
      .Delete
      .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
      xlBetween, Formula1:=ValListStr
      .IgnoreBlank = True
      .InCellDropdown = True
    End With
    This is triggerd by
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    If Target.Address = "$E$1" Then
      Call ValList
    End If
    
    End Sub
    Attached Files Attached Files
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1