Consulting

Results 1 to 9 of 9

Thread: Solved: Help with Code

  1. #1
    VBAX Tutor jo15765's Avatar
    Joined
    Oct 2011
    Posts
    281
    Location

    Solved: Help with Code

    I am trying to get code to display text on one line and a percent on the line below it...The code that I have this far will allow combining a text and percent field, but I want them to display like this:

    Test
    25%

    This code:
    [vba]
    =B19&TEXT(D19," #%")
    [/vba]
    Places them side by side, how can I add a line break or carraige return or whatever to make the percent go under the text?
    Last edited by Aussiebear; 11-03-2011 at 02:37 AM. Reason: adjusted the code tags for the correct usage

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Of course you need the cell format Wrap Text set.
    =B19&CHAR(10)&TEXT(D19," #%")

  3. #3
    VBAX Tutor jo15765's Avatar
    Joined
    Oct 2011
    Posts
    281
    Location
    Kenneth that code adds the pipe character between my text and my percentage, not an actual return. Is that formatting that I need to change?

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    I should have added a box character if you did not set the Wrap Text format as I explained.

  5. #5
    VBAX Tutor jo15765's Avatar
    Joined
    Oct 2011
    Posts
    281
    Location
    Good Gravy, once I added the wrap text it worked just as you said it would. Thank you for your help!!!

  6. #6
    VBAX Tutor jo15765's Avatar
    Joined
    Oct 2011
    Posts
    281
    Location
    Actually let me ask this since this was the purpose for me wanting this information...I have pie charts based off of Access Queries. Well when the percentage on the query updates the pie chart doesn't always update. So what I was going to do for a "Band-Aid" was to input the formula above as the pie chart tag so that when the percentage in the query updates, so will the percentage on the chart.

    Does that sound feasible, or am I way out in left field on that one?

  7. #7
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    You can ask that in another thread.

    It could be something simple. I would suggest that you make a simple access file and an excel file with the chart. I know that that can take a bit of effort but it helps us help you more quickly and accurately. Sounds like you just need to update the chart series.

  8. #8
    VBAX Tutor jo15765's Avatar
    Joined
    Oct 2011
    Posts
    281
    Location
    One more question pertaining to this code:
    [vba]
    =B19&CHAR(10)&TEXT(D19," #%")
    [/vba]
    If it is showing 0% when I input that code it is just showing a % sign, what needs to be added in order to force it to show 0 if null?
    Last edited by Aussiebear; 11-03-2011 at 02:38 AM. Reason: adjusted the code tags for the correct usage (...Again)

  9. #9
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    =If(D10="",B19&CHAR(10)& "0%",B19&CHAR(10)&TEXT(D19," #%"))

Posting Permissions

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