+ Reply to Thread
Results 1 to 3 of 3

Cell value as named range for validation list

  1. #1

    Cell value as named range for validation list

    I have the following code to define a validation list based on the
    named range A_CASE_BACK_TYPE
    How can I refer to a cell value as opposed to typing the named range.
    In short I want to refer to cell "K3" (which has the named range name)
    to define the validation list.

    Range("E3").Select
    With Selection.Validation
    .delete
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertWarning,
    Operator _
    :=xlBetween, Formula1:="=A_CASE_BACK_TYPE"
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = ""
    .ErrorTitle = "NOT LISTED"
    .InputMessage = ""
    .ErrorMessage = "YOUR CHOICE IS NOT ON THE LIST"
    .ShowInput = True
    .ShowError = True
    End With


  2. #2
    bpeltzer
    Guest

    RE: Cell value as named range for validation list

    With the defined name entered in K3, try =INDIRECT($K$3) as your list source.

    "[email protected]" wrote:

    > I have the following code to define a validation list based on the
    > named range A_CASE_BACK_TYPE
    > How can I refer to a cell value as opposed to typing the named range.
    > In short I want to refer to cell "K3" (which has the named range name)
    > to define the validation list.
    >
    > Range("E3").Select
    > With Selection.Validation
    > .delete
    > .Add Type:=xlValidateList, AlertStyle:=xlValidAlertWarning,
    > Operator _
    > :=xlBetween, Formula1:="=A_CASE_BACK_TYPE"
    > .IgnoreBlank = True
    > .InCellDropdown = True
    > .InputTitle = ""
    > .ErrorTitle = "NOT LISTED"
    > .InputMessage = ""
    > .ErrorMessage = "YOUR CHOICE IS NOT ON THE LIST"
    > .ShowInput = True
    > .ShowError = True
    > End With
    >
    >


  3. #3

    Re: Cell value as named range for validation list

    Thank you very much for the reply...I had a problem with your tip and
    came up with the following that appears to work. Your use of the
    INDIRECT function greatly helped another issue that I was having.
    Thanks again,
    Bill

    Range("E3").Select
    With Selection.Validation
    .delete
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertWarning,
    Operator _
    :=xlBetween, Formula1:=Range("K3").Value
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = ""
    .ErrorTitle = "NOT LISTED"
    .InputMessage = ""
    .ErrorMessage = "YOUR CHOICE IS NOT ON THE LIST"
    .ShowInput = True
    .ShowError = True
    End With


+ 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