Script that creates section for every grid line

Script only works on my plan north/south grids and does not work on plan east/west, any help?