Create a single square (e.g.10x10), select it, click Object>Transform>Transform Each and set Move Horizontal to the same value as the square side, in my example 10px. Click Copy. To create another square click CTRL+D. Create as many horizontal as you need and group the line. Repeat the Transform Each using Move Vertical...and so on and on.
↧