Question : Preserve data format in text box in excel03

I want data in a text box to be formatted as 0.00 or 00.00, so I'm using the code below to make this happen.  However, I'm a little confused about which event to use to make this work properly.  The change event seems to cause problems, and I'm also having issues with the exit event.  I want for the formatting to take place as soon as the user takes the focus off of the text box, but I also want this formatting to be preserved if the user should return to the userform to perhaps change this value.  

Currently, if you close and then return to the userform, it seems that you need to run the command again to perform the formatting, but I can't figure out how to make that work.  I tried calling the exit procedure prior to going to the appropriate page of the multipage control, but it doesn't work.  In the code below, ProposedFee is the name of one of the text boxes.  Thanks for your help!
1:
2:
3:
4:
5:
6:
7:
Private Sub ProposedFee_exit(ByVal Cancel As MSForms.ReturnBoolean)
    If ProposedFee < 10 Then
        ProposedFee = Format(ProposedFee, "0.00")
    Else
        ProposedFee = Format(ProposedFee, "00.00")
    End If
End Sub

Answer : Preserve data format in text box in excel03

Change the AfterUpdate subs to:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Private Sub ProposedPrice_AfterUpdate()
    ProposedPrice = Format(ProposedPrice, "0.00")
    Sheets("data").Range("N12").Value = CDbl(ProposedPrice)
End Sub

Private Sub ProposedFee_AfterUpdate()
    ProposedFee = Format(ProposedFee, "0.00")
    Sheets("data").Range("N13").Value = CDbl(ProposedFee)
End Sub

Private Sub CurrentPrice_AfterUpdate()
    CurrentPrice = Format(CurrentPrice, "0.00")
    Sheets("data").Range("N8").Value = CDbl(CurrentPrice)
End Sub
Random Solutions  
 
programming4us programming4us