Problem displaying a calculation result in a user form

G

Guest

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??
 
B

Bob Phillips

Show the code?

--

HTH

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

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top