RandBetween - prevent values changing - VBA?

robbertly

New Member
Joined
Oct 19, 2014
Messages
32
Hello,

My question is in relation to RandBetween and freezing the output so that it does not change each time.

I have multiple cells containing RandBetween, I would like to be able to freeze the output/values so that they do not recalculate each time the sheet / workbook opens or I do something on the sheet.

I would like to create multiple sheets with values created by RandBetween and then instruct excel to change the output to value only, ie. create a 'master' version, copy the master version to create multiple sheets and have excel freeze the output so that all sheets show value only output

Any assistance greatly appreciated.

Thanks,
 

Attachments

  • mrexcel.png
    mrexcel.png
    129.8 KB · Views: 7

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Copy the cells with the RANDBETWEEN formula and then paste special, values.

Hope that helps,

Doug
 
Upvote 0
Hi,

Thanks for the reply, Yes that worked....

Just one other question. How can I apply that to multiple sheets without having to go into each sheet and activate the macro?

Is that possible?

Thanks,
 
Upvote 0
How many sheets need this to be done? Is the data in the same cells on every worksheet in the workbook? Are the cells with the RANDBETWEEN formulas the only cells with formulas? There are a lot of ways to approach this.
 
Upvote 0
Hi,

Many thanks for taking the time to follow up on this.

Essentially this is the outline:
  • The workbook has 24 sheets, and I would like to be able to apply the macro / code / VBA etc to all 24 sheets
  • The cells only have RandBetween content - no formulas or other content
  • I want it to apply to the same specific cells on each worksheet - B1 to Y10 and B14 to Y2060
That's it.

Any assistance will be appreciated.

Thanks
 
Upvote 0
No problem.

Try this...Ctrl-select multiple worksheets, on the visible sheet select one of the two ranges you mentioned, right-click copy, right-click paste special values. Do the same for the other range and you should be done.

I tested on two sheets, but it should work for as many sheets as you Ctrl-select.

Doug
 
Upvote 0
Solution
Hi,

Just finished checking.... yes, works perfectly

I was expecting some complicated VBA or script... just goes to show the power and flexibility of excel!

Many thanks for your assistance, you saved me invaluable time and frustration!

Keep up the good work with other excel beginners here on MrExcel

Regards,

Robbert
 
Upvote 0
You're welcome. There are many ways to achieve the same results...this one struck me as the easiest and/or most appropriate.

We are glad to help and thanks for the feedback!

Doug
 
Upvote 0
You can also do something like this.
Everytime when you change the value in Cell A1, the cells are recalculating. Use this formula

Excel Formula:
=INT(MOD(A1*SEQUENCE(5,5)/PI(),1)*10^5)

1698910787823.png
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,952
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top