View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Atishoo Atishoo is offline
external usenet poster
 
Posts: 267
Default Restrictions on Addresses

Private Sub CommandButton1_Click()
With Worksheets("blacklist").Range("A:A")
If ActiveCell.Value < "" Then
Set c = .Find(ActiveCell.Value, LookIn:=xlValues)
If Not c Is Nothing Then
Dim Res As Long
Res = MsgBox("Address is Blacklisted:" & vbCrLf &
c.Offset(0, 1).Value)
Cancel = Res < 6
End If
End If
End With
End Sub

This variant adds the line "Address is Blacklisted" before the reason why,
or could contain any other comment you wished to place between the "" in the
sub.

When Addresses are input is the entire address entered into one cell or is
it split across cells?
ie street name and number in collumn A , town in column B and so on? and
would you be looking to use the same format on the blacklist?
If so the sub above would need to be changed to compare all cells containing
elements of the address.
All the best John