Consulting

Results 1 to 7 of 7

Thread: Dislay an asterisk after a number

  1. #1

    Dislay an asterisk after a number

    I have the code below that displays the total calculation of a single column. how do I display this number with an asterisk (i.e. 9965.75*)

    [VBA]frmPDCalc.Test5B.Caption = Format(.SumIf(Range("B11:B375"), "<=" & CSng(This_Date), Range("I11:I375")), "$##,###0.00" & "*")
    [/VBA]

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    [vba]frmPDCalc.Test5B.Caption = Format(.SumIf(Range("B11:B375"), "<=" & CSng(This_Date), Range("I11:I375")), "$##,###0.00\*") [/vba]untested.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    The code given accomplishes what I'm trying to acheive, but because their is an asterisk after the currency value, other parts of my code are triggering an error. My speculation is the the other parts of the code is not reading the value as a currency number because of the value.

    Is there a way to include the asterisk, but still be read as a currency value?

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Quote Originally Posted by av8tordude
    ...but because their is an asterisk after the currency value, other parts of my code are triggering an error...
    Is there a way to include the asterisk, but still be read as a currency value?
    Probably.
    Let's have some examples of the kind of code which causes an error (just a line or two in each case if possible)?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    This part of my code errors. When it errors, I moved my cursor over "EL6B.caption" to see what the currency value is and it displays the currency number with the asterisk.


    [vba]DL8B.Caption = Format(CCur(Replace(Replace(EL6B.caption, "$", ""), ",", "")) - CCur(Replace(Replace(Test7B.Caption, "$", ""), ",", "")), "$##,###0.00")[/vba]
    Last edited by av8tordude; 01-16-2011 at 07:10 PM.

  6. #6
    Ok..I found a workaround for my problem. I replaced the $ with an asterisk symbol

  7. #7
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    By doing calculations with captions you are doing maths on strings. Captions are for humans to read. Perhaps you could hold the values you want to do calculations on, in variables (or cells) of the correct type (numeric). Then use those results, modified as you want, say with Format, to display the result to humans as a string caption.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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