View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
gregork gregork is offline
external usenet poster
 
Posts: 102
Default Text Box Format

Thanks for the help guys. I have used Robert's code and it works fine except
for when the text box value = "", then I get a type mismatch error. Any
suggestions how to prevent this from happening?

Regards
Greg

"Robert Bradshaw" wrote in message
...
gregork wrote:
I have a textbox on a user form that displays data from a worksheet. How

can
I format the text box so that it only displays a number to 2 decimal

places?

Cheers
Greg


or in the lostfocus code for the textbox:

Private Sub TextBox1_LostFocus()
TextBox1.Value = Round(TextBox1.Value, 2)
End Sub