The problem of wave-number selection by a ramp, i.e., a region smoothly matching sub- and supercritical domains, is considered within the framework of the cubic and quintic Ginzburg-Landau (GL) equations with a sign-changing overcriticality parameter. A local frequency is also allowed to be a smooth function of the spatial coordinate. For the cubic model, a unique value of the selected wave number is found by means of an asymptotic procedure valid when the imaginary parts of coefficients in the GL equation are small, while the group velocity is arbitrary. Under certain conditions, the wave number may lie outside the stability band, which is expected to give rise to a dynamical chaos. In the quintic model, which describes a system with the inverted bifurcation, the selection scenario is much simpler: A front separating a traveling wave and the trivial state is expected to be pinned at the point of the ramp where its velocity, regarded as a function of the local overcriticality, vanishes. Eventually, the wave-number selection is performed by the pinned front. Experimentally, the selection may be realized in the traveling-wave convection, or in a self-oscillatory chemical system.