data validation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have a list of phone numbers (C1:C100), in A1 you enter in a phone number, if the number you enter is from the list, nothing happens, if it is not on the list, i need a text box to pop up saying "Continue" then yes or no. if yes, i need Macro1, if no, nothing to happen

Thanks in advance
 
Dim ans
If WorksheetFunction.CountIf(Range("C1:C100"), Range("A1")) > 0 Then
ans = MsgBox("Continue", vbYesNo)
If ans = vbYes Then macro1
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Choice said:
i have a list of phone numbers (C1:C100), in A1 you enter in a phone
number, if the number you enter is from the list, nothing happens, if it is
not on the list, i need a text box to pop up saying "Continue" then yes or
no. if yes, i need Macro1, if no, nothing to happen.
 
This is what i put in but nothing seems to be working, im not sure if i am supposed to change anything with the worksheet functio

Dim an
If WorksheetFunction.CountIf(Range("Tracking!C4:C1000"), Range("Sale!P2")) > 0 The
ans = MsgBox("Please Enter in Tracker", vbYesNo
If ans = vbYes Then SortTracke
End If
 
Put it in a worksheet change event

Private Sub Worksheet_Change(ByVal Target As Range)
Dim ans
If Target.Address = "$A$1" Then
If WorksheetFunction.CountIf(Range("C1:C100"), Range("A1")) > 0 Then
ans = MsgBox("Continue", vbYesNo)
If ans = vbYes Then macro1
End If
End If

End Sub

right-click on the sheet tab, select View Code, and paste it in

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

choice said:
This is what i put in but nothing seems to be working, im not sure if i am
supposed to change anything with the worksheet function
 
This might be better in the tracking worksheet

Private Sub Worksheet_Change(ByVal Target As Range)
Dim ans
If Target.Address = "$A$1" Then
If WorksheetFunction.CountIf(Range("C4:C100"), Range("Sale!P2")) > 0
Then
ans = MsgBox("Continue", vbYesNo)
If ans = vbYes Then macro1
End If
End If

End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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