Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Digits after the comma in Userform

In my database-sheet there are amounts, that can have one digit after the
comma (f.a. 540,7 or 540). In my userform I want these amounts shown as
$540,70 / $540,00. How can I do that?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Digits after the comma in Userform

Try this

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
textbox1.Text=format(textbox1.Text,"$0,00")
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gert-Jan" wrote in message
...
In my database-sheet there are amounts, that can have one digit after the
comma (f.a. 540,7 or 540). In my userform I want these amounts shown as
$540,70 / $540,00. How can I do that?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Digits after the comma in Userform

Thanks, Bob.

I changed the code a bit, now it works fine: (mb2 =label)

mb2.Caption = Range("Sheets3!Q3").Value
mb2.Caption = Format(mb2.Caption, "?0.00")

Gert-Jan

"Bob Phillips" schreef in bericht
...
Try this

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
textbox1.Text=format(textbox1.Text,"$0,00")
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gert-Jan" wrote in message
...
In my database-sheet there are amounts, that can have one digit after the
comma (f.a. 540,7 or 540). In my userform I want these amounts shown as
$540,70 / $540,00. How can I do that?






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Digits after the comma in Userform

Hi Gert-Jan,

If you are getting data from a cell, and that cell is already formatted, you
could just use

mb2.Caption = Range("Sheets3!Q3").Text

or at least do it in one move

mb2.Caption = Format(Range("Sheets3!Q3").Value, "?0.00")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gert-Jan" wrote in message
...
Thanks, Bob.

I changed the code a bit, now it works fine: (mb2 =label)

mb2.Caption = Range("Sheets3!Q3").Value
mb2.Caption = Format(mb2.Caption, "?0.00")

Gert-Jan

"Bob Phillips" schreef in bericht
...
Try this

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
textbox1.Text=format(textbox1.Text,"$0,00")
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gert-Jan" wrote in message
...
In my database-sheet there are amounts, that can have one digit after

the
comma (f.a. 540,7 or 540). In my userform I want these amounts shown as
$540,70 / $540,00. How can I do that?








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you change single digits to recognized double digits? Evil with a K[_2_] Excel Worksheet Functions 5 April 3rd 23 02:29 PM
VBA write macro change column with 3 number digits to 4 digits the James C[_2_] Excel Discussion (Misc queries) 3 January 25th 10 03:12 PM
Inserting comma(,) after every two digits of a number from right t Senapati Excel Worksheet Functions 2 October 28th 09 11:55 AM
How to customize number to 10 digits including 2 digits after deci Carina Excel Worksheet Functions 3 September 20th 07 02:50 AM
Display numbers in a userform txtfield as numbers with a comma TimT Excel Programming 2 December 11th 05 10:57 PM


All times are GMT +1. The time now is 11:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"