gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,345
- Office Version
- 365
- Platform
- Windows
I am trying to check to see if data already exist in a table by using the Application.WorksheetFunction.Match function.
And I am able to create a formula that works "If there is a Match".
how do i get this to work if it doesnt find a match?
Thanks
And I am able to create a formula that works "If there is a Match".
Code:
Private Sub CommandButton2_Click()
Dim Find As Variant
'Sheet22.Range("B4").Value = Application.WorksheetFunction.Match(Sheet16.Range("B6").Value, Sheet22.Range("B6:B200"), 0)
Find = Application.WorksheetFunction.Match(Sheet16.Range("B6").Value, Sheet22.Range("B6:B200"), 0)
If Find.Value > 1 Then
Sheet16.Range("Buyer_List1").Copy
Sheet22.Range("B5").End(xlDown).Offset(1).PasteSpecial
Application.CutCopyMode = False
Sheet22.Activate
Else
MsgBox "This Buyer ID is already included in the List"
End If
End Sub
how do i get this to work if it doesnt find a match?
Thanks