+ Reply to Thread
Results 1 to 5 of 5

Validate List from non-Adjacent cells

Hybrid View

  1. #1
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Validate List from non-Adjacent cells

    No problem though from your prior posts I always assumed you had a complete aversion to VBA given the insistence on formulae resolution (even in the face of inefficiency).

    If using VBA it would probably make sense to apply it to a Change event against A2:Ax given alterations on those cells should in turn affect the validation list itself... however ignoring that for the being...

    -- using [C8] is generally slower than using Range("C8")

    -- per your pseudo-code Test should read CL

    -- if as assumed above A2:Ax are constants you can further limit the iteration by using SpecialCells - ie ignore blanks in the first instance

    Dim CL As Range, LST As String
    On Error Resume Next
    For Each CL In Range(Cells(2,"A"),Cells(Rows.Count,"A")).End(xlup).SpecialCells(xlCellTypeConstants).Cells
      LST = LST & "," & CL.Value
    Next CL
    With Range("C8").Validation
        .Delete
        .Add Type:=xlValidateList, AlterStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=Replace(LST,1,1,"")
    End With

  2. #2
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Validate List from non-Adjacent cells

    Thanks,

    No - no "aversion" against VBA and/or Helper columns but I prefer not to use them UNLESS there is no other solution.

    As I rely on your judgment & Excel knowledge and after reading your first reply, to this question, I wrote this short piece of code.

    Elm

+ 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