Cell formatting, thus conditional formatting also, is used for view/display purpose only and does not apply any restrictions on possible cell value. For valid data range definition, you shall use Data Validity dialog, menu
Data->Validity... item. But, as far as I know, it is not possible to apply different Data Validity rules for one cell, based on some condition. That means you can not define multiple Data Validity rules for one cell ang chose them based on predefined test, such as cell value, formula result and so on.
Fortunately, Data Validity feature allows to use formulas, that return area or array, so as a workaround for your goal, you can define such Validity rules combination:
Cell1 - Only Yes/No value accepted.
Cell2 - Only range of numbers accepted
Cell3 - IF formula, that returns 0, if
Cell1="No", or returns Cell2 value, if
Please also see this sample file attached.