View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
pinmaster
 
Posts: n/a
Default Freezing the cell (with Random formula)


Hi, here's one way.

Start by inserting a new worksheet, in any cell put =RAND() and copy
down as far as needed, next copy those cells and paste them over your
current cell containing your rand() formula....Paste as link. Drag the
worksheet to the far left making worksheet 1, you can now hide the
worksheet. In the worksheet where you just pasted those cell, insert 2
radio button from the visual basic toolbar, name 1 "Calc On" the other
"Calc Off" then put this in the Calc On code:

Private Sub OptionButton1_Click()
Worksheets(1).EnableCalculation = True
End Sub
....this will turn on calculation of the new worksheet generating new
random numbers

and this into Calc Off

Private Sub OptionButton2_Click()
Worksheets(1).EnableCalculation = False
End Sub
...this will turn off calculation of the new worksheet freezing the
random numbers until calculation is turn on again

then Exit out of design mode

now when you need to generate new random numbers select Calc On then
Calc Off, as long as Calc Off is selected those random numbers will not
change.

It may be out of the ordinary but it should work.

HTH
JG


--
pinmaster
------------------------------------------------------------------------
pinmaster's Profile: http://www.excelforum.com/member.php...fo&userid=6261
View this thread: http://www.excelforum.com/showthread...hreadid=495078