+ Reply to Thread
Results 1 to 2 of 2

VBA for Data Validation

  1. #1
    Registered User
    Join Date
    10-30-2003
    Posts
    49

    VBA for Data Validation

    When a string is entered in file1.xls column range A:A, I would like to see if it is on file2.xls column range A:A and if it is, a message box come up with instructions...and to deny the entry of the string. Of course, if it is not in file2.xls, then the string will remain.

    file1.xls (A:A) file2.xls (A:A)

    BobA TimE
    JackC
    SaraE


    If I try to enter TimE into file1.xls, a message will pop up because TimE is listed in file2.xls


    ANY help would be appreciated. Thanks in advance.

  2. #2
    filo666
    Guest

    RE: VBA for Data Validation

    easy

    on your sheet objects (file 1.xls):

    Private Sub Worksheet_Change(ByVal Target As Range)
    if left(target.address,2)=$A then
    a=target
    windows("file 2.xls").activate
    for b=1 to ActiveSheet.Range("A1",
    activesheet.Range("A65535").End(xlUp)).EntireRow.count
    if a=cells(a,1) then
    windows(file 1.xls).activate
    target=""
    msgbox "Whatever you want to say","button","title"
    end
    end if
    next
    windows(file 1.xls").activate
    end sub

    this should works, any problems just write me

    "TimE" wrote:

    >
    > When a string is entered in file1.xls column range A:A, I would like to
    > see if it is on file2.xls column range A:A and if it is, a message box
    > come up with instructions...and to deny the entry of the string. Of
    > course, if it is not in file2.xls, then the string will remain.
    >
    > file1.xls (A:A) file2.xls (A:A)
    >
    > BobA TimE
    > JackC
    > SaraE
    >
    >
    > If I try to enter TimE into file1.xls, a message will pop up because
    > TimE is listed in file2.xls
    >
    >
    > ANY help would be appreciated. Thanks in advance.
    >
    >
    > --
    > TimE
    > ------------------------------------------------------------------------
    > TimE's Profile: http://www.excelforum.com/member.php...fo&userid=2139
    > View this thread: http://www.excelforum.com/showthread...hreadid=489144
    >
    >


+ 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