Hi mintymike
This Code is in the attached and appears to do as you require. Please note, in the event of ties it picks the first.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ColNo As String
Dim myCol As String
Dim FindString As String
Dim rng As Range
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$14" Then
FindString = Range("A14").Value
With Sheets("Sheet1").Range("A:A")
Set rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
ColNo = MinAddress(Range(Cells(rng.Row, 1), Cells(rng.Row, 8)))
End If
End With
myCol = Split(ColNo, "$")(1)
Application.EnableEvents = False
Range("B14").Value = Cells(2, myCol).Value
Application.EnableEvents = True
End If
End Sub
'From http://support.microsoft.com/kb/139574
Function MinAddress(The_Range)
Dim MinNum As Long
Dim cell As Range
' Sets variable equal to minimum value in the input range.
MinNum = Application.Min(The_Range)
' Loop to check each cell in the input range to see if equals the
' min variable.
For Each cell In The_Range
If cell = MinNum Then
' If the cell value equals the max variable it
' returns the address to the function and exits the loop
MinAddress = cell.Address
Exit For
End If
Next cell
End Function
Bookmarks