Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Formatting for Currency - results label

Formatting for Currency - results label

Formatting for Currency - results label

I still can't make this thing work!!!
I've tried what I find in books to make the final resulting calculation (in LblEI.Caption) format for currency, but I can't get it to do it. As it's set up, I get a "." instead of a "," and if the last number in the answer is a "0" it drops it. Also, sometimes the answer will go to 4 decimal places. I've figured everything else out except for this.
What I want is "$###,###" as a format. The numbers used for this calc are not currency, but I want the final result to be currency.

' if attendance is greater than peakroomcount
' multiply peakroomcount by 1.8
' whichever is less - attendance or new peakroomcount and multiply * 1.451

Private Sub BookingFormula2()
Dim Vara
Dim Varprc&
Dim Xprv
Vara = Val(TxtAttend.Text)
Varprc = Val(TxtPRC.Text)
Xprv = Varprc * 1.8

If Vara > Varprc Then
Xprv = Varprc * 1.8
If Vara < Xprv Then
LblEI.Caption = Vara * 1.451
Else: LblEI.Caption = Xprv * 1.451

End If
End If
End Sub

RE: Formatting for Currency - results label

Thanks DougP, but it still wouldn't work - am I writing it wrong?

After the LblEI.Caption lines, I write...
LblEI.Caption = Format(Vara, "#,###.00)
LblEI.Caption = Format(Xprv, "#,###.00)

As an example, when I plug in 100 and 50 for my two numbers, the LblEI.Caption says 130.59 --- what I want is 130,590 or at least 130.590

Another example is when I plug in 150 and 78, I get 203.7204 -- I need least 203.720 or 203,720


RE: Formatting for Currency - results label

I've plugged in both of your suggestions, but it somehow wreaks the formula - I get totally different results in LblEI.

Any other thoughts out there?
This is so frustrating -- I'm so close to success!


RE: Formatting for Currency - results label

how about format(vara, ".000")

RE: Formatting for Currency - results label

and here is something else to try

This example uses the CCur function to convert an expression to a Currency.

Dim MyDouble, MyCurr
MyDouble = 543.214588 ' MyDouble is a Double.
MyCurr = CCur(MyDouble * 2) ' Convert result of MyDouble * 2
' (1086.429176) to a
' Currency (1086.4292).
then format the Result
= Format(MyCurr ,"$##0.00")


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close