The rise of transcranial current stimulation (tCS) techniques have sparked an increasing interest in the effects of weak extracellular electric fields on neural activity. These fields modulate ongoing neural activity through polarization of the neuronal membrane. While the somatic polarization has been investigated experimentally, the frequency-dependent polarization of the dendritic trees in the presence of alternating (AC) fields has received little attention yet. Using a biophysically detailed model with experimentally constrained active conductances, we analyze the subthreshold response of cortical pyramidal cells to weak AC fields, as induced during tCS. We observe a strong frequency resonance around 10-20 Hz in the apical dendrites sensitivity to polarize in response to electric fields but not in the basal dendrites nor the soma. To disentangle the relative roles of the cell morphology and active and passive membrane properties in this resonance, we perform a thorough analysis using simplified models, e.g. a passive pyramidal neuron model, simple passive cables and reconstructed cell model with simplified ion channels. We attribute the origin of the resonance in the apical dendrites to (i) a locally increased sensitivity due to the morphology and to (ii) the high density of h-type channels. Our systematic study provides an improved understanding of the subthreshold response of cortical cells to weak electric fields and, importantly, allows for an improved design of tCS stimuli.