Reputation: 21
I have a sheet containing defined table named table123
I am pulling data from database and ( using loop ) going through all records.
What I want to do is ( thanks to VBA ) check whether values from database exist in the table123
What is the best solution to do this ?
Thanks in advance,
Upvotes: 0
Views: 14768
Reputation: 96753
Say we want to know if there is treasure in Sheet3, table Table1
Sub TreasureHunt()
Dim r As Range, IsItThere As Range
Set r = Sheets("Sheet3").ListObjects("Table1").Range
Set IsItThere = r.Find(What:="treasure", After:=r(1))
If IsItThere Is Nothing Then
MsgBox "no treasure in the table"
Else
MsgBox "treasure is in the table"
End If
End Sub
Upvotes: 2