Ok guys I have a solution. I thought I knew a lot until I got here. Thanks hay.
This is a group of may functions and I know someone here can do it better and I will welcome any comments.
First declare the variables
Dim row, value, val3 As Variant
Next set the variables
value = Range("G3").value
val3 = Range("F3").value
F3 has the header and G3 the value
Now find and select the Column with the same header
Rows("1:1").Select
Selection.Find(What:=val3, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.EntireColumn.Select
Now find the value within the selected range and set the last "row" variable
Selection.Find(What:=value, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
row = ActiveCell.row
I do have a problem with the value lookup where the code crashes if the value is not found.
The "row" variable can now be used in a cell or the vb code in conjunction with the hlookup function.
Bookmarks