+ Reply to Thread
Results 1 to 7 of 7

Currency conversion insert currency symbol

Hybrid View

siobeh Currency conversion insert... 04-30-2013, 06:33 AM
ragulduy Re: Currency conversion... 04-30-2013, 07:04 AM
siobeh Re: Currency conversion... 04-30-2013, 07:53 AM
siobeh Re: Currency conversion... 04-30-2013, 10:38 AM
siobeh Re: Currency conversion... 05-01-2013, 03:28 AM
a8015945 Re: Currency conversion... 05-01-2013, 05:44 AM
a8015945 Re: Currency conversion... 05-01-2013, 05:50 AM
  1. #1
    Forum Contributor
    Join Date
    04-23-2013
    Location
    India
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    227

    Currency conversion insert currency symbol

    Hello, i just want to insert the currency symbol in textbox, however there's a formula on it:

    Ex: If Combobox1 is GBP, when i type a number in textbox1 for example "100", input will be "100 £" and textbox2 will be "155 $".

    Currency symbol:

    EUR = €
    GBP = £
    USD = $
    DKK = kr
    NOK = kr

    Textbox1 will be Local Currency and Textbox2 will be conversion amount in USD.

    
    Private Sub TextBox1_Change()
    
    If ComboBox1.Value = "USD" Then
    TextBox2.Value = (TextBox1.Value * 1)
    Exit Sub
    End If
    
    If ComboBox1.Value = "GBP" Then
    TextBox2.Value = (TextBox1.Value * 1.55)
    Exit Sub
    End If
    
    If ComboBox1.Value = "EUR" Then
    TextBox2.Value = (TextBox1.Value * 1.3)
    Exit Sub
    End If
    
    If ComboBox1.Value = "DKK" Then
    TextBox2.Value = (TextBox1.Value * 0.174882)
    Exit Sub
    End If
    
    If ComboBox1.Value = "NOK" Then
    TextBox2.Value = (TextBox1.Value * 0.167815)
    Exit Sub
    End If
    
    
    End Sub
    
    Private Sub UserForm_Click()
    
    End Sub
    
    Private Sub UserForm_Initialize()
    
    With ComboBox1
    
    
    .AddItem "GBP"
    .AddItem "EUR"
    .AddItem "USD"
    .AddItem "DKK"
    .AddItem "NOK"
    
    
    End With
    
    
    
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Currency conversion insert currency symbol

    I'm not sure if it is possible to apply a formatting to a textbox the same way you would in excel, I'm not aware of any methods for this, therefore the best you could do would be something like:
    TextBox1.Value = Format(TextBox1.Value, "$##,###")
    or just
    Textbox1.Value = "$" & Textbox1.Value
    However, this can lead to quite a few problems as it will leave you with the format as part of the string, which you will then try and perform arithmetic with - you would probably need to add quite a lot of error handling to cope with if the user enters just a number, or edits the existing value and leaves the currency symbol etc. You already have the currency selected in the box above - it's probably quite a lot of work just to get a symbol that doesn't tell you anything you don't know already. Or have the currency symbol as a label to the left of the textbox.

  3. #3
    Forum Contributor
    Join Date
    04-23-2013
    Location
    India
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    227

    Re: Currency conversion insert currency symbol

    Hello yudlugar, it only works for USD, when i try in GBP, it gives me an error: Type mismatch


    
    If ComboBox1.Value = "USD" Then
    TextBox2.Value = Format(TextBox1.Value * 1, "$##,###")
    TextBox1.Value = Format(TextBox1.Value, "$##,###")
    
    Exit Sub
    End If
    
    If ComboBox1.Value = "GBP" Then
    TextBox2.Value = Format(TextBox1.Value * 1.55, "GBP##,####")
    TextBox1.Value = Format(TextBox1.Value, "GBP##,###")
    Exit Sub
    End If

  4. #4
    Forum Contributor
    Join Date
    04-23-2013
    Location
    India
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    227

    Re: Currency conversion insert currency symbol

    can anyone help me on this?

  5. #5
    Forum Contributor
    Join Date
    04-23-2013
    Location
    India
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    227

    Re: Currency conversion insert currency symbol

    anyone please

  6. #6
    Registered User
    Join Date
    01-28-2013
    Location
    Coventry
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Currency conversion insert currency symbol

    Like yudlugar said try

    Textbox1.Value = "$" & Textbox1.Value
    But know that because the symbol ($) is part of the string, it cannot be used in a formula.

    You could try not using the $ sign at all, and set up a table with a $ as a column header. That way you use text for labels only and numbers for values only.

  7. #7
    Registered User
    Join Date
    01-28-2013
    Location
    Coventry
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Currency conversion insert currency symbol

    another thought, set up a label on your userform, place it next to the USD textbox. In this Label, change the settings so that it shows $ symbol, and change colour setting so it matches your background

+ 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