On 2002-06-23 17:12, Yogi Anand wrote:
Hi inarbeth:
I am not sure if my proposed solution will work for you -- I have the following macro:
Private Sub CommandButton1_Click()
' created 6/23/02 by Yogi Anand
Range("A1").Select
If [A1]<= 31 Then Selection.NumberFormat = "[<32]##""th"";General"
If [A1] = 1 Then Selection.NumberFormat = "[=1]##""st"";General"
If [A1] = 2 Then Selection.NumberFormat = "[=2]##""nd"";General"
If [A1] = 3 Then Selection.NumberFormat = "[=3]##""rd"";General"
If [A1] = 21 Then Selection.NumberFormat = "[=21]##""st"";General"
If [A1] = 22 Then Selection.NumberFormat = "[=22]##""nd"";General"
If [A1] = 23 Then Selection.NumberFormat = "[=23]##""rd"";General"
End Sub
I created a CommandButton on a worksheet of a workbook and I assigned the above written macro to the command button.
I make my number entry in cell A1 (valid entries are 1 to 31)
Then I click on the CommandButton to see
1 formatted to 1st
2 formatted to 2nd
3 formatted to 3rd
.......
The numeric value of the entry stays intact, it is just formatted as 1st, 2nd, 3rd, ...
Hope This Helps
Regards!
Edit Note: I have not fully tested it -- some tweaking may be necessary -- you may also have to tweak it to adapt it to your needs. I would have gone strictly for CUSTOM formatting only without the benefit of a macro, but as you correctly pointed out, one cannot accommodate all the CUSTOM formats natively.
This message was edited by Yogi Anand on 2002-06-23 17:16