Place two 3/4-by-6-by-22 1/2-inch boards parallel to one another with their long, thin edges on the working surface. Hold them in place about 6 inches apart. These are the top and bottom boards of the vanity light box.
Position a 3/4-by-6-by-6-inch board against the ends of the top and bottom boards so they make a 6-by-24-inch rectangular frame. Drill two holes through each of these boards, which are the side boards, and into each end of the top and bottom boards. Attach the boards together with 2-inch wood screws.
Set a 1/4-by-6-by-24-inch board on top of the rectangular frame. Drill holes every six inches through this board, which is the rear board, and into the frame. Attach the rear board to the frame with 2-inch wood screws.
Remove the vanity light bar from its attachment in the wall, if it has already been installed there. Locate and mark the studs in the wall section with a stud finder if the studs have not already been marked during the light installation.
Position the vanity box with the rear of the box against the wall. Drill through the rear of the box at each stud position, drilling all the way into the studs. Attach the box to the wall with 3-inch wood screws. Drill any necessary holes in the box for the wires to exit. Install the vanity lights to the box the same way that they were installed on the wall.