No offense, but this seems like a very odd way to do this.
Perhaps work on making the database more of a relational database and less of a big spreadsheet. If you work on the data structure, I bet you will find there is an easier way to present your information without relying on so much code...