Column Name

  • Thread starter Thread starter Matt Russell
  • Start date Start date
M

Matt Russell

I need a formula to return the column name of the second occurence of
the heading "Q3 2007T".

Thanks
 
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

http://www.mvps.org/dmcritchie/excel/getstarted.htm
best wishes
 
Back
Top