This User Defined function does what you want. Call it with, for example,
=FIND2(A1:AZ1)
Function find2(myrange)
For Each mycell In myrange
If mycell.Value = "Q3 2007T" Then
mycount = mycount + 1
End If
If mycount = 2 Then
Set mc = mycell
myaddress = mc.Address()
Exit For
End If
Next
If mycount < 2 Then
find2 = "found " & mycount
Else
find2 = myaddress
End If
End Function
New to VBA? See David McRitchie's site on "getting started" with VBA
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.