+ Reply to Thread
Results 1 to 3 of 3

Problem displaying a calculation result in a user form

  1. #1
    AndyRoo
    Guest

    Problem displaying a calculation result in a user form

    I have developed a fairly simple game in Excel 2002. One feature is a
    statistics box that shows the player the numbers of wins and losses and the
    percentage of wins.

    I have set this up using 3 text boxes each with a ControlSource link to the
    sheet and cell that contains the relevant data. It works fine for the
    numbers of wins and the number of losses but I keep finding that the 3rd item
    hits a bug whereby the cell containing the calculation of the win percentage
    somehow loses the calculation and it is replaced by an integer.

    Can anyone help? Maybe there is an easier/more secure way to calculate the
    win percentage from within the user form??

  2. #2
    Bob Phillips
    Guest

    Re: Problem displaying a calculation result in a user form

    Show the code?

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "AndyRoo" <[email protected]> wrote in message
    news:[email protected]...
    > I have developed a fairly simple game in Excel 2002. One feature is a
    > statistics box that shows the player the numbers of wins and losses and

    the
    > percentage of wins.
    >
    > I have set this up using 3 text boxes each with a ControlSource link to

    the
    > sheet and cell that contains the relevant data. It works fine for the
    > numbers of wins and the number of losses but I keep finding that the 3rd

    item
    > hits a bug whereby the cell containing the calculation of the win

    percentage
    > somehow loses the calculation and it is replaced by an integer.
    >
    > Can anyone help? Maybe there is an easier/more secure way to calculate

    the
    > win percentage from within the user form??




  3. #3
    AndyRoo
    Guest

    Re: Problem displaying a calculation result in a user form

    Not sure what you mean by 'show the code'. If you mean what I have written
    in the Macro, it is shown below.

    In the sheet the statistics are in ('stats') I have a calculation for
    percentage wins as follows in cell B9:

    =IF(ISERROR(100*B5/B7),0,(100*B5/B7)). In Cell B11 I have a formula to
    round that to 1 decimal, =ROUND(B9,1).

    In the properties box for my userform I have tried linking to both cells B9
    and B11 using the ControlSource property. I have found that when I enter
    Sheets!B9 (or B11 for that matter) in the section for ControlSource then the
    user form picks up the figure I want it to, at first.

    However after a couple of uses of the game the macro is in, I find the
    figure for percentage wins no longer updates. When I investigate I find that
    the formula in the calculation cells has disappeared and in its place is an
    integer (not a random one, it is the calculated percentage of wins the last
    time the formula worked).

    I have tried stepping through the code in debugging mode but nothing goes
    wrong when I step through the code, so I am baffled.

    Hope that is clear, any help gratefully received.

    "Bob Phillips" wrote:

    > Show the code?
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "AndyRoo" <[email protected]> wrote in message
    > news:[email protected]...
    > > I have developed a fairly simple game in Excel 2002. One feature is a
    > > statistics box that shows the player the numbers of wins and losses and

    > the
    > > percentage of wins.
    > >
    > > I have set this up using 3 text boxes each with a ControlSource link to

    > the
    > > sheet and cell that contains the relevant data. It works fine for the
    > > numbers of wins and the number of losses but I keep finding that the 3rd

    > item
    > > hits a bug whereby the cell containing the calculation of the win

    > percentage
    > > somehow loses the calculation and it is replaced by an integer.
    > >
    > > Can anyone help? Maybe there is an easier/more secure way to calculate

    > the
    > > win percentage from within the user form??

    >
    >
    >


+ 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