VBA for Data Validation

  • Thread starter Thread starter TimE
  • Start date Start date
T

TimE

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top