Room size select

I wanted to make a room size setting menu for my game, like in Word, when you create a table. I want it, so when the player presses one of the squares, it highlights the selected ones.How could i go about it?

Give every cell a coordinate, make the topleft cell the 0,0 coordinate. that way when a player clicks cell 4,3 you can loop the cells till 4,3 and give those a different material.

Actually, I “solved” to problem, I’m now using an other way of doing this, because this just looked awful