Hey Everyone,
Currently I am using the tool found here;
http://www.arcgis.com/home/item.html?id=9398bd2232cb4c8490b0b05015364d28
Now it works great and does exactly what id like but one slight tweak I would like to make is as it iterates each shape and creates the grid, I would just like to Intersect it with my original grids geometry so I do not get any grids outside the shape. For example;

Now I believe I have identified the area of the code in which I need to perform this operation but it has not been working for me, wondering if anyone could point me in the direction I am possibly going wrong or help in anyway possible. Here is the area of code I am changing and inserting my tweaks.

The error returned is shown below;

Thank you to anyone who has the time to help out! Appreciate it.