Are you wanting to write VBA code (macro) to do that or did you want to do
this without code. The short answer is that it can not be done without code.
The closest you get is conditional formats which can modify cell formats, but
number formats are not included in the list of attributes accessable via
conditional formatting.