Consulting

Results 1 to 6 of 6

Thread: currency in a concatenated string

  1. #1
    VBAX Regular
    Joined
    Sep 2006
    Posts
    21
    Location

    currency in a concatenated string

    Hi guys



    Would appreciate some help with currency formats in a concatenated string.

    I have a string that include references to cells in another worksheet. The string works just fine but cell reference parts are supposed to be dollar amounts...


    Sheets("FormEnglish").Cells(73, 1) = "If you are enrolling for [product] in excess of the GI amount of" & " " & Sheets("Questions").Cells(43, 4) & " " & "or if your spouse is enrolling for coverage in excess of 50% of the amount that you enroll for or" & " " & Sheets("Questions").Cells(43, 5) & " " & ", you must complete and submit an EOI. The form is available from your employer/benefits administrator, or is available online at...


    Instead, it comes out like this...

    If you are enrolling for [product] in excess of the GI amount of 500000 or if your spouse is enrolling for coverage in excess of 50% of the amount that you enroll for or 150000 , you must complete an and submit and Evidence of Insurability form. The form is available from your employer/benefits administrator, or is available online at...

    Is there some way I can format the amounts to be currency?

    Any assistance will be greatly appreciated.


    Cindy
    Last edited by dattagal; 07-09-2007 at 01:31 PM.

  2. #2
    Knowledge Base Approver
    The King of Overkill!
    VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Hi Cindy,

    You could use the Format() function around the cell reference along with a currency number format, but if the cell is already formatted the way you want it, use .Text after the cell instead of the default property of .Value you are (unknowingly) using
    So instead of [vba]Sheets("Questions").Cells(43, 4)[/vba]Use [vba]Sheets("Questions").Cells(43, 4).Text[/vba]That will pull what is being shown in the cell.

    Matt

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Sheets("FormEnglish").Cells(73, 1) = "If you are enrolling for [product] in excess of the GI amount of" & " " & Format(Sheets("Questions").Cells(43, 4),"$#,##0.00") & " " & "or if your spouse is enrolling for coverage in excess of 50% of the amount that you enroll for or" & " " & Format(Sheets("Questions").Cells(43, 5),"$#,##0.00") & " " & ", you must complete and submit an Evidence of Insurability form. The form is available from your employer/benefits administrator, or is available online at...
    Last edited by dattagal; 07-09-2007 at 01:33 PM.

  4. #4
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    I may be slightly off track here but i tink its done like this:
    [vba]
    MsgBox Format(0#, "$") & Range("A1").Value
    [/vba]
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  5. #5
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Ermm.....not only was i slow but wrong!
    Tut!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  6. #6
    VBAX Regular
    Joined
    Sep 2006
    Posts
    21
    Location
    Awesome!!! and you're so quick too!

    thanks so much! this is so cool!

Posting Permissions

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