View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Helpme Helpme is offline
external usenet poster
 
Posts: 34
Default Find match from 1st 3 columns and return the row number

Thank you! This is very helpful but I have a couple of questions:

1- where is the row number of the match?
2- FindRowAfterMatch is the row number of the next non blank in col A?
3- What happens if combination found is the last row in rowcount, what would
be the value of FindRowAfterMatch?

Thank you very much for your help.

"Joel" wrote:

Try this function

Function FindRowAfterMatch() As Long

With ActiveSheet
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
FoundMatch = False
For RowCount = 2 To LastRow
If FoundMatch = False Then
If .Range("A" & RowCount) = "DDD" And _
.Range("B" & RowCount) = "EEE" And _
.Range("C" & RowCount) = "FFF" Then

FoundMatch = True
End If
Else
If .Range("A" & RowCount) < "" Then
FindRowAfterMatch = RowCount
Exit For
End If
End If

Next RowCount

End With

End Function


"HelpMe" wrote:

I need help writing a function that would find a match in the first 3 columns
in a sheet. Then return the row number where the combination was found. Then
return the row number of the next non blank row it finds. Here is an example:

Row1 ColA ColB ColC
Row2 DDD EEE FFF
Row3
Row4 HHH

I would need to search for the row that contains DDD in ColA, if match then
look for EEE in ColB, and if match then look for FFF in ColC. Once found then
return the row number where found, in this case 2. Then find the next value
in ColA that is non blank and return this row number, in this case 4.

I really appreciate your help with this. God bless you all for all the help
you provide!