Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to set bottom and top values for randbetween
I want to select a cell or a range of cells, then fill it with randbetween numbers. The bottom and top values will vary from time to time. How can I accomplish this. Maybe have an input box appear where the user could enter the bottom/top values, or designate 2 cells where the user could input the values, invoke the macro, and have it refer to those 2 cells to get the bottom/top values?
Thanks! Tonso |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to set bottom and top values for randbetween
hi Tonso,
i suppose the values are in range("A1") and range("B1") x = Evaluate("randbetween(" & [A1] & "," & [B1] & ")") -- isabelle Le 2012-10-03 10:22, Tonso a écrit : I want to select a cell or a range of cells, then fill it with randbetween numbers. The bottom and top values will vary from time to time. How can I accomplish this. Maybe have an input box appear where the user could enter the bottom/top values, or designate 2 cells where the user could input the values, invoke the macro, and have it refer to those 2 cells to get the bottom/top values? Thanks! Tonso |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to set bottom and top values for randbetween
On Wednesday, October 3, 2012 10:22:17 AM UTC-4, Tonso wrote:
I want to select a cell or a range of cells, then fill it with randbetween numbers. The bottom and top values will vary from time to time. How can I accomplish this. Maybe have an input box appear where the user could enter the bottom/top values, or designate 2 cells where the user could input the values, invoke the macro, and have it refer to those 2 cells to get the bottom/top values? Thanks! Tonso isabelle, Thank you very much!! tonso |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to set bottom and top values for randbetween
On Wednesday, October 3, 2012 10:22:17 AM UTC-4, Tonso wrote:
I want to select a cell or a range of cells, then fill it with randbetween numbers. The bottom and top values will vary from time to time. How can I accomplish this. Maybe have an input box appear where the user could enter the bottom/top values, or designate 2 cells where the user could input the values, invoke the macro, and have it refer to those 2 cells to get the bottom/top values? Thanks! Tonso Isabelle, The macro works great if a single cell is selected. If more than 1 cell is selected, the value in eery cell is the same. I need to have a different value returned for each cell selected, whether it is a singel cell, or serveral or more cells. Thanks, Tonso |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to set bottom and top values for randbetween
Hi Tonso,
Am Wed, 3 Oct 2012 08:16:55 -0700 (PDT) schrieb Tonso: The macro works great if a single cell is selected. If more than 1 cell is selected, the value in eery cell is the same. I need to have a different value returned for each cell selected, whether it is a singel cell, or serveral or more cells. try it with: Selection.Formula = "=randbetween(" & [A1] & "," & [B1] & ")" Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to set bottom and top values for randbetween
two possibilities,
Sub test1() For Each c In Selection Range(c.Address) = Evaluate("randbetween(" & [A1] & "," & [B1] & ")") Next End Sub Sub test2() 'version without doubloon Dim v As Integer, i As Integer Set dico = CreateObject("Scripting.Dictionary") Do Until i = [B1] - [A1] + 1 v = Int(([B1] - [A1] + 1) * Rnd() + [A1]) If Not dico.Exists(v) Then dico.Add v, v i = i + 1 End If Loop [A2].Resize(i) = Application.Transpose(dico.items) End Sub -- isabelle Le 2012-10-03 11:16, Tonso a écrit : Isabelle, The macro works great if a single cell is selected. If more than 1 cell is selected, the value in eery cell is the same. I need to have a different value returned for each cell selected, whether it is a singel cell, or serveral or more cells. Thanks, Tonso |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to set bottom and top values for randbetween
On Wednesday, October 3, 2012 10:22:17 AM UTC-4, Tonso wrote:
I want to select a cell or a range of cells, then fill it with randbetween numbers. The bottom and top values will vary from time to time. How can I accomplish this. Maybe have an input box appear where the user could enter the bottom/top values, or designate 2 cells where the user could input the values, invoke the macro, and have it refer to those 2 cells to get the bottom/top values? Thanks! Tonso Isabelle, Claus, Thank you both so much for your expert help!! Sincerely, Tonso |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
average out of bottom 10 values | Excel Worksheet Functions | |||
Getting x axis values on bottom in a logarithmic scale chart | Excel Discussion (Misc queries) | |||
Column Values Re-Order Bottom to Top | Excel Worksheet Functions | |||
3d Graph Show Values at Bottom | Excel Worksheet Functions | |||
transposing values top to bottom | Excel Discussion (Misc queries) |