Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default In Excel How Do I Random a Number but Not when it recalculates?

I am trying to make a Macro that will select a few cells and random number
between 1-100 (I have done this). But when I use =RANDBETWEEN(1,100) whenever
I change a number in my cells it randoms. I was wondering whether there was a
=random that doesnt do after every recalculate. Or a Macro term.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 897
Default In Excel How Do I Random a Number but Not when it recalculates?

Why not just paste in the value after you use the formula? I believe
all of the random functions (RAND, etc) are volatile.

HTH,
JP

On Feb 27, 4:56*pm, TxcPhtm wrote:
I am trying to make a Macro that will select a few cells and random number
between 1-100 (I have done this). But when I use =RANDBETWEEN(1,100) whenever
I change a number in my cells it randoms. I was wondering whether there was a
=random that doesnt do after every recalculate. Or a Macro term.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default In Excel How Do I Random a Number but Not when it recalculates

Thats not what I meant I mean so when i click a button they change
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,819
Default In Excel How Do I Random a Number but Not when it recalculates

Press the F9 button.

TxcPhtm wrote:

Thats not what I meant I mean so when i click a button they change


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,059
Default In Excel How Do I Random a Number but Not when it recalculates?

On Feb 27, 1:56*pm, TxcPhtm wrote:
I am trying to make a Macro that will select a few cells and
random number between 1-100 (I have done this). But when
I use =RANDBETWEEN(1,100) whenever I change a number
in my cells it randoms. I was wondering whether there was a
=random that doesnt do after every recalculate. Or a Macro term.


I am a little confused. On the one hand, you say are "trying to make"
a macro that does this; on the other hand, you say you are using
=RANDBETWEEN(1,100), presumably in an Excel cell. Moreover, you say
that "a macro" will select a few cells. Usually, you select the
cells, then execute a macro to operate on the selected cells.
(Although, of course, you can indeed write the macro so that it makes
the selection.)

Be that as it may, you might be able to accomplish your task (whatever
that is) by computing the random number(s) within the macro. In Excel
2007, you might be able to use WorkSheetFunction.Randbetween, since I
believe the RANDBETWEEN() is now a standard Excel function. I don't
know; I cannot do that in Excel 2003. Alternatively, you can write
your own function, namely:

Function myRandBetween(low As Long, high As Long) As Long
myrandbetween = low + Int((high - low + 1) * Rnd())
End Function
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
whole workbook recalculates when I change a cell Smallweed Excel Discussion (Misc queries) 3 October 10th 07 02:20 PM
In excel, I want to generate a random number to the max Excel Discussion (Misc queries) 7 June 20th 07 07:49 PM
Excel recalculates on startup? Tom Hayakawa Excel Worksheet Functions 4 December 30th 05 07:32 PM
Excel random number JJ Excel Discussion (Misc queries) 2 May 4th 05 01:19 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 02:58 AM.

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

About Us

"It's about Microsoft Excel"