If you drag a stack into (or out of) a container or your inventory (or between 2 inventory windows), and hold down the control key before dropping, it will bring up a split stack pane, which will let you specify how many to transfer.