I am getting a few errors with VBA code that I have written to convert from a formula based query.
Cell.Offset(0, 37).Value = Application.WorksheetFunction.IfError(Application.WorksheetFunction.Index((Sheets("CP INFO").Range("N6:AK570")), Application.WorksheetFunction.Match(Cell.Offset(0, 36).Value, Sheets("CP INFO").Range("N6:AK570"), 0), 1), "No SFH")
The error is stating unable to get the 'Match property of the worksheetfunction class.
The original formula for the above code is -
=IFERROR(INDEX('CP INFO'!$N$6:AK$570,MATCH(VALUE(AK4),'CP INFO'!$N$6:$N$570,0),1),"NO SFH") SO I cannot see what is wrong with it.
The next error I am getting is with the below code.
Cell.Offset(0, 39).Value = Application.WorksheetFunction.IfError(Left(Application.WorksheetFunction.IfError(Left(Right(Cell.Offset(0, 24), _
Len(Cell.Offset(0, 24)) - Application.WorksheetFunction.Find("(", Cell.Offset(0, 24))), (Len(Cell.Offset(0, 24)) - Application.WorksheetFunction.Find("-", Cell.Offset(0, 24))) + 1), ""), _
Application.WorksheetFunction.Find("-", Application.WorksheetFunction.IfError(Left(Right(Cell.Offset(0, 24), Len(Cell.Offset(0, 24)) - _
Application.WorksheetFunction.Find("(", Cell.Offset(0, 24))), (Len(Cell.Offset(0, 24)) - Application.WorksheetFunction.Find("-", Cell.Offset(0, 24))) + 1), "")) - 1), _
Application.WorksheetFunction.IfError(Left(Right(Cell.Offset(0, 24), Len(Cell.Offset(0, 24)) - _
Application.WorksheetFunction.Find("(", Cell.Offset(0, 24))), (Len(Cell.Offset(0, 24)) - Application.WorksheetFunction.Find("-", Cell.Offset(0, 24))) + 1), ""))
This error is relating to the find function stating unable to find the property. I'm a real novice when it comes to these functions within VBA so no doubt I am doing something wrong or missing something?
Original formula this code has come from.
=IFERROR(LEFT(IFERROR(LEFT(RIGHT(DATA2!Y4,LEN(DATA2!Y4)-FIND("(",DATA2!Y4)),(LEN(DATA2!Y4)-
FIND("-",DATA2!Y4))+1),""),FIND("-",IFERROR(LEFT(RIGHT(DATA2!Y4,LEN(DATA2!Y4)-
FIND("(",DATA2!Y4)),(LEN(DATA2!Y4)-FIND("-",DATA2!Y4))+1),""))-1),IFERROR
(LEFT(RIGHT(DATA2!Y4,LEN(DATA2!Y4)-FIND("(",DATA2!Y4)),(LEN(DATA2!Y4)-FIND("-",DATA2!Y4))+1),""))
The design of this macro is to loop through roughly 3-5k rows of data and produce a report of data pre sorted. The Cell is the current row and Column A The offset is to post values in corresponding Columns if the criteria is met.
Hopefully someone can assist.
Regards Alan
WorksheetFunctionin vba code, but to write the code that does what the function does. If you insist on using the function, then look intoworksheet().Evaluate