Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Random Number

Hello,

I am generating a random number as follows:
=RANDBETWEEN(10000000;99999999)

How can I make the cell recalculate a new random number every time I
click the cell?

Is this possible?

Thanks,
Miguel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Random Number

On the off chance you don't know this, just pressing F9 will cause the sheet
to recalc. Since RANDBETWEEN() is volatile, it will recalc.

Otherwise you can use a macro to do it. Right-click on the sheet tab and
select VIEW CODE. Paste in this macro to the sheet module that appears:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$5" Then
Calculate
Range("C5").Select
End If
End Sub


Edit the $B$5 to the cell where you want it to watch. Then close the editor
and save the sheet. Now, click on any other cell, then click on B5. It
should reassert a new value each time you click on it.

Does that help?
--
"Actually, I *am* a rocket scientist." -- JB
(www.MadRocketScientist.com)

Your feedback is appreciated, click YES if this post helped you.


"shapper" wrote:

Hello,

I am generating a random number as follows:
=RANDBETWEEN(10000000;99999999)

How can I make the cell recalculate a new random number every time I
click the cell?

Is this possible?

Thanks,
Miguel
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Addding a Random number to a fixed number..... Dermot Excel Discussion (Misc queries) 6 August 20th 06 12:17 PM
How can I match a random number with closest number from sequence? Matt Excel Worksheet Functions 4 August 3rd 06 01:22 AM
same number appears in a random number generator Carmel Excel Worksheet Functions 4 May 28th 06 12:22 AM
Generating (in a random order)each number once from a given number Neil Goldwasser Excel Worksheet Functions 2 December 2nd 05 11:27 PM
How do I find random number in list of random alpha? (Position is. jlahealth-partners Excel Discussion (Misc queries) 0 February 8th 05 05:31 PM


All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"