Calculation

S

Sullivan

One possible way to do this is to start with an unbound
text box, call it TAnswer. Then, for the Total Number
Textbox (let's call it TTotNum), put a procedure for after
it's updated (if you only want the answer when this is
changed, and not when the range is changed).

Then, in that procedure, make sure that the text boxes for
the min and max of the range are filled in (call them TMin
and TMax). If there are, then you can do a loop from the
max to the min and find the first value that doesn't need
to be rounded. Then, you say TAnswer.Value =
maxevendivsor.

So...it'd be something like this.

Private Sub TTotNum_Update()
'Here, check to make sure TMax and TMin aren't null -
aka, have no values. If they are null, display an error?

div = TMax.Value
While div > TMin.Value
hold = TTotNum.Value/Div
if Round(hold) = hold then
Exit Sub
Else
div = div -1
End if
Wend

TAnswer.Value = div

End Sub

Hope this helps!

Sullivan
 

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