+ Reply to Thread
Results 1 to 2 of 2

data validation-How do I apply the list and <> both to the cells?

  1. #1
    Meliisa
    Guest

    data validation-How do I apply the list and <> both to the cells?

    Hi
    I have 2 cells that I would like to apply the same data validation list to.
    However, the cells cannot equal each other. How do I apply the list and <>
    both to the cells?
    Thansk for all replies
    Melissa

  2. #2
    Jason Morin
    Guest

    re: data validation-How do I apply the list and <> both to the cells?

    Set up your validation list for both A1 and B1. Then
    right-click on the worksheet tab, select "View Code", and
    paste in the code below. Press ALT+Q to close:

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    With Application
    If Intersect(Target, [B1]) Is Nothing Then GoTo CheckA1
    .EnableEvents = False
    With Target
    If .Value = .Offset(0, -1).Value Then
    MsgBox "List selections cannot be the same!"
    .Value = ""
    End If
    End With
    .EnableEvents = True
    Exit Sub
    CheckA1:
    If Intersect(Target, [A1]) Is Nothing Then Exit Sub
    .EnableEvents = False
    With Target
    If .Value = .Offset(0, 1).Value Then
    MsgBox "List selections cannot be the same!"
    .Value = ""
    End If
    End With
    .EnableEvents = True
    End With
    End Sub

    ---
    HTH
    Jason
    Atlanta, GA

    >-----Original Message-----
    >Hi
    >I have 2 cells that I would like to apply the same data

    validation list to.
    >However, the cells cannot equal each other. How do I

    apply the list and <>
    >both to the cells?
    >Thansk for all replies
    >Melissa
    >.
    >


+ 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