I've been trying to search a table for a predetermined value and if that value is not there, add that value and then create a new line in the table.
Sounds simple I know.
tblrow = tbllook.Range.Columns(1).Cells.Find(shtfind, searchorder:=xlByRows, searchdirection:=xlPrevious).Row
MsgBox tblrow
If tblrow Is Nothing Then
tblcount = tbllook.Range.Rows.Count
tbllook.Range(tblcount, 1).Select
ActiveCell = shtfind
tbllook.ListRows.Add
End If
Tblerow is currently Dim'd as variant.
I get the a correct answer back in the msgbox when it is found in the table but then spits out an "Object Required" error on the If statement.
But when the value is not found in the table it still spits out the same error.
I have tried changing my Dim of tblrow to an Object but then get an "object variable or With block variable not set" on my .find line even I put set in front of it.
My googling of the problem has told me that is because it didn't find a value in the table and that the If statement that I have added should sort this but it has not.
Please help.