Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Have TextBox display a dollar value

When these TextBoxes get populated, is there any way to make them display
the result in dollars and cents?


Sub DisplayPay()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

DataInput.TextBox611.Text = rng(1, 99) ' Dispatch Pay
DataInput.TextBox612.Text = rng(1, 98) 'Driveing Pay
DataInput.TextBox613.Text = rng(1, 100) + rng(1, 101) ' Overtime
DataInput.TextBox615.Text = rng(1, 119) 'Total Pay

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Have TextBox display a dollar value

DataInput.TextBox611.Text = "$ " & rng(1, 99) ' Dispatch Pay
DataInput.TextBox612.Text = "$ " & rng(1, 98) 'Driveing Pay
DataInput.TextBox613.Text = "$ " & rng(1, 100) + rng(1, 101) ' Overtime
DataInput.TextBox615.Text = "$ " & rng(1, 119) 'Total Pay

If this post helps click Yes
--------------
Jacob Skaria


"Patrick C. Simonds" wrote:

When these TextBoxes get populated, is there any way to make them display
the result in dollars and cents?


Sub DisplayPay()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

DataInput.TextBox611.Text = rng(1, 99) ' Dispatch Pay
DataInput.TextBox612.Text = rng(1, 98) 'Driveing Pay
DataInput.TextBox613.Text = rng(1, 100) + rng(1, 101) ' Overtime
DataInput.TextBox615.Text = rng(1, 119) 'Total Pay

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Have TextBox display a dollar value

You may use the conver to currency function

"$ " & Ccur(rng(1, 99))

If this post helps click Yes
--------------
Jacob Skaria


"Patrick C. Simonds" wrote:

When these TextBoxes get populated, is there any way to make them display
the result in dollars and cents?


Sub DisplayPay()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

DataInput.TextBox611.Text = rng(1, 99) ' Dispatch Pay
DataInput.TextBox612.Text = rng(1, 98) 'Driveing Pay
DataInput.TextBox613.Text = rng(1, 100) + rng(1, 101) ' Overtime
DataInput.TextBox615.Text = rng(1, 119) 'Total Pay

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Have TextBox display a dollar value

While this puts a $ in front of the number it does not round the number down
to 2 digits after the . What I get is $158.14523


"Jacob Skaria" wrote in message
...
You may use the conver to currency function

"$ " & Ccur(rng(1, 99))

If this post helps click Yes
--------------
Jacob Skaria


"Patrick C. Simonds" wrote:

When these TextBoxes get populated, is there any way to make them display
the result in dollars and cents?


Sub DisplayPay()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

DataInput.TextBox611.Text = rng(1, 99) ' Dispatch Pay
DataInput.TextBox612.Text = rng(1, 98) 'Driveing Pay
DataInput.TextBox613.Text = rng(1, 100) + rng(1, 101) ' Overtime
DataInput.TextBox615.Text = rng(1, 119) 'Total Pay

End Sub



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Have TextBox display a dollar value

You can use the Round function or Format function.

Round (Ccur(158.1482),2) = 158.15
Format(158.1482,"0.00") = 158.15

DataInput.TextBox611.Text = "$ " & Round(rng(1, 99),2)
DataInput.TextBox612.Text = "$ " & Round(rng(1, 98) ,2)
DataInput.TextBox613.Text = "$ " & rng(1, 100) + rng(1, 101),2)
DataInput.TextBox615.Text = "$ " & rng(1, 119) ,2)


If this post helps click Yes
--------------
Jacob Skaria


"Patrick C. Simonds" wrote:

While this puts a $ in front of the number it does not round the number down
to 2 digits after the . What I get is $158.14523


"Jacob Skaria" wrote in message
...
You may use the conver to currency function

"$ " & Ccur(rng(1, 99))

If this post helps click Yes
--------------
Jacob Skaria


"Patrick C. Simonds" wrote:

When these TextBoxes get populated, is there any way to make them display
the result in dollars and cents?


Sub DisplayPay()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

DataInput.TextBox611.Text = rng(1, 99) ' Dispatch Pay
DataInput.TextBox612.Text = rng(1, 98) 'Driveing Pay
DataInput.TextBox613.Text = rng(1, 100) + rng(1, 101) ' Overtime
DataInput.TextBox615.Text = rng(1, 119) 'Total Pay

End Sub






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Have TextBox display a dollar value

Another way using Format:

Dim x As Double
x = 158.14523
MsgBox Format(x, "$0.00")

--
Tim Zych
http://www.higherdata.com
Workbook Compare - Excel data comparison utility
Free and Pro versions

"Patrick C. Simonds" wrote in message
...
While this puts a $ in front of the number it does not round the number
down to 2 digits after the . What I get is $158.14523


"Jacob Skaria" wrote in message
...
You may use the conver to currency function

"$ " & Ccur(rng(1, 99))

If this post helps click Yes
--------------
Jacob Skaria


"Patrick C. Simonds" wrote:

When these TextBoxes get populated, is there any way to make them
display
the result in dollars and cents?


Sub DisplayPay()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

DataInput.TextBox611.Text = rng(1, 99) ' Dispatch Pay
DataInput.TextBox612.Text = rng(1, 98) 'Driveing Pay
DataInput.TextBox613.Text = rng(1, 100) + rng(1, 101) ' Overtime
DataInput.TextBox615.Text = rng(1, 119) 'Total Pay

End Sub





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Have TextBox display a dollar value

See subject: "Userform Text box Format to Currency" in this ng a couple of
days ago.

Regards,
Peter T

"Patrick C. Simonds" wrote in message
...
When these TextBoxes get populated, is there any way to make them display
the result in dollars and cents?


Sub DisplayPay()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

DataInput.TextBox611.Text = rng(1, 99) ' Dispatch Pay
DataInput.TextBox612.Text = rng(1, 98) 'Driveing Pay
DataInput.TextBox613.Text = rng(1, 100) + rng(1, 101) ' Overtime
DataInput.TextBox615.Text = rng(1, 119) 'Total Pay

End Sub



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
Rounding dollar amounts in half dollar increments DC Excel Worksheet Functions 2 January 20th 10 04:19 PM
display the textbox by clicking a cell tkraju via OfficeKB.com Excel Discussion (Misc queries) 0 November 4th 09 06:13 PM
How do I set $100 display as one hundrer dollar? New user Setting up and Configuration of Excel 1 January 14th 09 10:23 AM
Comparing Row by Row - A-D dollar amounts to E dollar amount Mel Excel Worksheet Functions 9 November 20th 08 09:50 PM
Qn: Display Text in TextBox in Userform Michael Vaughan Excel Programming 1 August 18th 04 05:06 PM


All times are GMT +1. The time now is 03:56 PM.

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

About Us

"It's about Microsoft Excel"