MrExcel Publishing
Your One Stop for Excel Tips & Solutions

suggestion or comments needed


Posted by Mindy on September 10, 2001 12:01 PM

Hi
I have a marco which need to do the find event for 2 set of columns for each row.

Ex: rows colA colB colC colD colE colF
1 123 abc 111 222 333 444
2 234 der 000 123 abc 222

the result I am looking for
colA=colD
and
colB=colE

the macro will search something has 123 in colD and abc in colE first. The 234 in colD and der in colE.

I did use the find method
set testfind = .columns("D").find(what:=123)

how can I look for both D and E at same time?
Any suggestion, comments, will be real appriciated.
Thank you in advance


Posted by faster on September 10, 2001 12:59 PM

two ideas


'here are two ideas for you
'if found the row is highlighted
Sub FindIt()

Dim NumA, NumB, NumD, NumE

Range("A1").Select

Do While Selection <> ""
NumA = Selection
NumB = Selection.Offset(0, 1)
NumD = Selection.Offset(0, 3)
NumE = Selection.Offset(0, 4)

If NumA = NumD And NumB = NumE Then
Selection.EntireRow.Interior.ColorIndex = 15
Selection.Offset(1, 0).Select
Else
Selection.Offset(1, 0).Select
End If
Loop

Range("A1").Select

End Sub


or

the following will return TRUE or FALSE, just put
it in the next blank column

=AND(A1=D1,B1=E1)