I am looking to find a variable within a row and return the column reference. The code I have written so far is;
Dim VarianceDate As String
VarianceDate = Sheets("Summary").Range("C12").Value
Rows("6").Find(What:=VarianceDate, After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
TargetCol = ActiveCell.Column
In this example the Variance date is 01/06/2015, however when I stepinto the code in VBA it returns nothing. Except When I search for it manually It finds the correct cell.
Eventually I would like to use the TargetCol reference to help me extract the correct data into another workbook.
Any help would be much appreicated.
Thanks
VarianceDate= nothing? Could you try a line like:Debug.Print VarianceDateto confirm this? If so, you'd need to make sure that your sheet and range references are correct.