+ Reply to Thread
Results 1 to 5 of 5

VBA userform – convert number to percent

  1. #1
    Registered User
    Join Date
    02-05-2010
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    9

    VBA userform – convert number to percent

    I have a problem with conversion of numbers to percent, that I hope some of you could help me with…

    In the attached sample (with macros enabled), you will find the problem when pressing the button “INDTAST DATA” (I apologize for the linguistic challenge, but the XL-sheets are in Danish… To relief – check the crash course in Danish below) and then entering some number in the two last textboxes (called “Forventet ændring i antal timer I næste kvartal (%)” and “Forventet ændring i omsætning i næste kvartal (%)”)… If you enter something there, the result will be multiplied by 100 in the worksheet.

    I would like to be able to simply enter a full number – like 12 or 9,5– which will then be entered into the worksheet as 12% or 9,5% (and not 1200% or 950%)… I think the answer lies in inserting some code in the VBA code, when the macro writes the data to the worksheet, but you guys know more about it than I do...

    I can, of course, enter a full number in the textboxes – followed by a %-sign, but that will slow down the process significantly as well as increase the risk of errors…

    BONUS: Crash course in Danish (to help with the linguistics)
    Virksomhed = Company
    Kvartal = Quarter
    År = Year
    Branche = Industry
    Fakturerede timer = Billed hours
    Faktureret omsætning = Billed revenue
    Timeforventning = Expected hours (next quarter)
    Omsætningsforventning = Expected revenue (next quarter)
    Indtast data = Enter data

    I hope it makes sense and that someone can provide a working solution
    Attached Files Attached Files
    Last edited by Kasperlindoe; 02-12-2010 at 10:21 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA userform – convert number to percent

    Maybe something like this?
    Please Login or Register  to view this content.

    Or, since you already appear to have the columns formatted:
    Please Login or Register  to view this content.

    Or even:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 02-12-2010 at 09:54 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-05-2010
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: VBA userform – convert number to percent

    Thank you very very much - it's working perfectly!

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA userform – convert number to percent

    Which one did you end up using?

    =======
    If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].

  5. #5
    Registered User
    Join Date
    02-05-2010
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: VBA userform – convert number to percent

    I just tried number three, since that seemed to be the simplest for me to understand

+ 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