View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default How do I generate only one random number without it refreshing?

joshman wrote:
What I've tried so far:
=randbetween(111111,999999)

But this number keeps changing every time any other data is entered into
other cells in the sheet, or a calculation processes.


Isn't that a bitch? I don't know what was going in the head of the kid
who decided that rand() and related functions should be volatile.

So, I disabled calculations, but that won't work b/c I need to have the
calculations available.


That should come as no surprise to anyone, except the aforementioned
kid, that is.

Oh, and I can't use macros b/c the sheet is going to be posted on the net.


Oops, now you've exhausted the only remedy I know. OTOH, I know of
plenty of spreadsheets available online that do indeed rely on a macro
to force a more reasonable behavior of random number generation. You
simply have to encourage your customers to select a reasonable macro
security level and trust you. I know: trust is difficult to earn.
But frankly, I would not trust just-any-spreadsheet-on-the-net anyway,
with or without macros. The virus inventors are just too clever for me
to take the chance.

Any suggestions for generating one random number and keeping it?


I ass-u-me you really need randbetween() or its ilk because
__sometimes__ you do want the random number to recalculate when the
spreadsheet is in someone else's hands. Right?

If not, of course you could simply copy-and-paste-special-value. But
that's too obvious, and you sound savvy enough. I am sure it does not
meet your needs.

IMHO, it is about time that we petition MS for an option (Tools
Options) to make rand() and related functions non-volatile, "breaking"
compatibility (to everyones delight, I'm sure). Don't get me wrong:
backward compatibility is a strong argument. But there is no good
argument against yet-another option. MS could even allow it to default
to its current moronic behavior.

Good luck in your quest for a more constructive response. I will be
watching this thread for it myself.