View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Corey Corey is offline
external usenet poster
 
Posts: 363
Default Add 2nd condition to Find

The below code searches for the Value that was selected in Listbox2.
But i have found that there maybe more than 1 value in that column (C)
If there is i Always gain the same data.
I placed the (<=== HERE) line of code to try to include a 2nd condition to ensure the correct data
is selected, but even though there IS a match, i get NO DATA at all.

The value in rngFound.Offset(0,15) is Always a date (dd/mm/yyyy) and the value in rngfound is Always
Text.

Dim rngFound As Range
On Error Resume Next
Sheets("Data2").Visible = True
Sheets("Data2").Unprotect
With Worksheets("Data2").Range("C:C")
Set rngFound = .Find(What:=ListBox2.Value, After:=.Cells(1), LookIn:=xlValues, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False)
If rngFound.Value < "" And ListBox3.Value = rngFound.Offset(0, 15).Value Then <=== HERE
....
....
....
end if
end with

Why does this not find the data with the 2nd condition ?


Corey....