Have TextBox display a dollar value

P

Patrick C. Simonds

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
 
J

Jacob Skaria

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
 
J

Jacob Skaria

You may use the conver to currency function

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

If this post helps click Yes
 
P

Patrick C. Simonds

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
 
J

Jacob Skaria

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
 
P

Peter T

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

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top