Thanks for the quick reply
i just want to make macro which goes at lowest possible level for the code 12345 in column A.
so in the example if one more layer is there "12345 i love india and elephants" it should retun that only.
so as per my logic macro should first check the codes present in column a weather it is same or not.
and secondly it should check the text present in the column B is part of immediate next cell if yes then it should move to next cell and check again weather the code in column A is same with previous cell and again the text is part of next cell in column B and so on.....
one point i would like to note if text in column B is not the part of immediate cell then it should return the same cell.
this is the logic please help or reply for more clarification.