+ Reply to Thread
Results 1 to 5 of 5

Formatting a VBA Form as Currency

Hybrid View

robert_shindorf Formatting a VBA Form as... 07-12-2008, 09:41 PM
mikerickson I'd put TextBox1.Text =... 07-12-2008, 11:00 PM
robert_shindorf ok, here it is, i was... 07-13-2008, 12:02 PM
royUK Use the textbox exit event to... 07-13-2008, 12:19 PM
shg I just learned that you can... 07-13-2008, 12:49 PM
  1. #1
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    ok, here it is, i was thinking it would be much easier, but i can't seem to get it.

    there are 6 categories that i need to format as a currency, they are:


    Assigned Fee
    Billing Rate
    Tax Strategies Fee
    Transactional Tax Fee
    Business Valuation Fee
    Website Fee

    here's the workbook, i'm pretty lost.
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Use the textbox exit event to format the contents

    Private Sub txtAsgnFee_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    With Me
    If Len(.txtAsgnFee.Value) > 0 Then .txtAsgnFee.Value = Format(txtAsgnFee.Value, _
        "Currency")
    End With
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    I just learned that you can use format names in a Format function -- my Excel lesson for the day, thanks, Roy.

    You could generalize Roy's approach a tad:
    Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
        FormatCurrency Me.TextBox1
    End Sub
    
    Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
        FormatCurrency Me.TextBox2
    End Sub
    
    Sub FormatCurrency(ctl As MSForms.TextBox)
        If Len(ctl.Value) Then ctl.Value = Format(ctl.Value, "Currency")
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1