I installed shelves in a closet with unevenly spaced studs. The shelves are mounted to the studs and they are level and secure. The shelve mounts can support a clothes hanging bar. The bar has holes where you can screw it into the wall. However, there is no stud where the rod hits the wall. When I try to screw the rod to the wall and the rod to the mount, the rod comes loose from the wall. There is a drywall stud very close to the place where the rod hits the wall. My thought is to screw a piece of wood into the drywall stud that will extend over the inch or so to where the rod hits the wall. Then screw the rod into the wood. Is this a good idea? Is there a better way?
The best way to handle this situation is to span two studs at the end of the closet with a smallish plank, screwing it into both studs. Then you can screw the rod end mount to that plank and rest assured that it's as sturdy as you can get it.
The "far" end of that plank will very probably screw to the stud at the far rear corner of the closet's end wall, which is kind of nice because that hides almost the entire plank.
An alternative, but one that's only suitable if you're definitely never going to hang a lot of clothing from that rod (clothing weight accumulates shockingly quickly), would be to use drywall anchors to attach the rod end mount to the drywall.