An injection device for expelling of a number of preset or user-selectable doses of a medicament, the injection device comprising: - an elongated housing (10; 310; 410) extending along a longitudinal axis and configured to accommodate a cartridge containing the medicament and having a bung sealing a proximal end of the cartridge, - an expelling mechanism comprising a trigger and a piston rod, wherein when induced by the trigger the piston rod is configured to urge against the bung along the longitudinal axis in a distal direction relative to the housing, - a dose setting mechanism comprising a rotatable member (260; 360; 460; 560) and a counterpart member (240; 340; 440; 540), wherein the counterpart member (240; 340; 440; 540) comprises a first mechanical code (242; 342; 442; 542), - wherein for setting of a dose the rotatable member (260; 360; 460; 560) is rotatable relative to the housing (10; 310; 410) and relative to the counterpart member (240; 340; 440; 540) within a range of numerous rotational states, and wherein during setting of the dose at least one of the rotatable member (260; 360; 460; 560) and the counterpart member (240; 340; 440; 540) is in a dose setting position and wherein during setting of the dose the rotatable member (260; 360; 460; 560) is constrained along the longitudinal axis relative to the housing (10; 310; 410) or relative to the counterpart member (240; 340; 440; 540), characterized in that the rotatable member (260; 360; 460; 560) comprises a second mechanical code (262; 362; 462; 562) complementary shaped to the first mechanical code (242; 342; 442; 542) and wherein for expelling of a dose one of the rotatable member (260; 360; 460; 560) and the counterpart member (240; 340; 440; 540) is displaceable along the longitudinal axis from the dose setting position into an expelling position (e) relative to the other one of the rotatable member (260; 360; 460; 560) and the counterpart member (240; 340; 440; 540) only when the first mechanical code (242; 342; 442; 542) is aligned with the second mechanical code (262; 362; 462; 562), wherein a longitudinal displacement of one of the rotatable member (260; 360; 460; 560) and the counterpart member (240; 340; 440; 540) into the expelling position (e) is impeded as long as the first mechanical code (242; 342; 442; 542) and the second mechanical code (262; 362; 462; 562) are out of alignment. - an elongated housing (10; 310; 410) extending along a longitudinal axis and configured to accommodate a cartridge containing the medicament and having a bung sealing a proximal end of the cartridge, - an expelling mechanism comprising a trigger and a piston rod, wherein when induced by the trigger the piston rod is configured to urge against the bung along the longitudinal axis in a distal direction relative to the housing, - a dose setting mechanism comprising a rotatable member (260; 360; 460; 560) and a counterpart member (240; 340; 440; 540), wherein the counterpart member (240; 340; 440; 540) comprises a first mechanical code (242; 342; 442; 542), - wherein for setting of a dose the rotatable member (260; 360; 460; 560) is rotatable relative to the housing (10; 310; 410) and relative to the counterpart member (240; 340; 440; 540) within a range of numerous rotational states, and wherein during setting of the dose at least one of the rotatable member (260; 360; 460; 560) and the counterpart member (240; 340; 440; 540) is in a dose setting position and wherein during setting of the dose the rotatable member (260; 360; 460; 560) is constrained along the longitudinal axis relative to the housing (10; 310; 410) or relative to the counterpart member (240; 340; 440; 540), characterized in that the rotatable member (260; 360; 460; 560) comprises a second mechanical code (262; 362; 462; 562) complementary shaped to the first mechanical code (242; 342; 442; 542) and wherein for expelling of a dose one of the rotatable member (260; 360; 460; 560) and the counterpart member (240; 340; 440; 540) is displaceable along the longitudinal axis from the dose setting position into an expelling position (e) relative to the other one of the rotatable member (260; 360; 460; 560) and the counterpart member (240; 340; 440; 540) only when the first mechanical code (242; 342; 442; 542) is aligned with the second mechanical code (262; 362; 462; 562), wherein a longitudinal displacement of one of the rotatable member (260; 360; 460; 560) and the counterpart member (240; 340; 440; 540) into the expelling position (e) is impeded as long as the first mechanical code (242; 342; 442; 542) and the second mechanical code (262; 362; 462; 562) are out of alignment.