Could You Pls post the Entire Code...? Try calling the Function by passing the exact OrderId like x = ExitBO("1645555000","165822222") If the above works than your code might be creating problem.
I have written the exact code while stating the problem.
However, I have now been able to resolve it by using the CStr() function to explicitly convert the OrderID and the ParentOrderID into strings before passing them as parameters.
Sheets("OrderBook").Cells(i, 1) returns Object So, Call Sheets("OrderBook").Cells(i, 1).Value --> which will return exact cell value. So no need to use CStr.
Could You Pls post the Entire Code...?
Try calling the Function by passing the exact OrderId like x = ExitBO("1645555000","165822222")
If the above works than your code might be creating problem.
However, I have now been able to resolve it by using the CStr() function to explicitly convert the OrderID and the ParentOrderID into strings before passing them as parameters.
That's Great.. You got solutions...
Your Initial Error was due to the fact that..
Sheets("OrderBook").Cells(i, 1) returns Object
So,
Call Sheets("OrderBook").Cells(i, 1).Value --> which will return exact cell value.
So no need to use CStr.