I have a dual gang light switch box which was previously hooked up to a ceiling fan with light. The two switches controlled the fan and light separately. I recently replaced the ceiling fan with just a simple light fixture and capped off the extra hot wire. Only one switch controls the light and the other switch does nothing. I'm currently looking to replace the switch that does nothing with an led guide light. The guide light requires a white neutral wire. Can I take the wire that is currently capped off at the ceiling and attached it to the white neutral line? On the dual gang box side, I attach the hot wire to the hot connector on the guide light and take the wire which goes to the ceiling (which will be attached to the white wire) and attached to the neutral connector. Will this work?
It was common to wire "switch loops" where a black and white wire were run between a switch and a light, and the white (neutral) wire would actually be used as a hot. When this was done, the white wire would be marked with black tape on both ends to say "this wire is really doing the job of a black wire". (wire colors are assuming common US conventions).
What you are proposing is doing something similar, but using a black wire as a neutral. This will work, but according to another question you can't repurpose a black wire as a neutral because code requires a neutral to be a certain color over the entire length of the wire.
So, electrically, it will work, but it seems to be an illegal modification.
It will work: just mark that wire with white tape (and write 'N' on it on both ends).