In this protocol, we describe the procedures we have developed to optimize the performance of voltage-sensitive dyes for recording changes in neuronal electrical activity. We emphasize our experience in finding the best dye conditions for recording backpropagating action potentials from individual dendritic spines in a neuron within a brain slice. We fully describe procedures for loading the dye through a patch pipette and for finding excitation and emission wavelengths for the best sensitivity of the fluorescence signal to membrane voltage. Many of these approaches can be adapted to in vivo preparations and to experiments on mapping brain activity via optical recording.