#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default randomize

Sub randomize()
Range("H2") = Int((Range("B4") - Range("B3") + 1) * Rnd + Range("B3")

End Sub

I want to randomize from more than "B4 - B3".

"B4 - B3" and "C4 - C3" and "D4 - D3" and "E4 - E3"

and get the rnd result in "H2

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default randomize

On Fri, 28 May 2004 15:07:22 -0500, dallas
wrote:

Sub randomize()
Range("H2") = Int((Range("B4") - Range("B3") + 1) * Rnd + Range("B3"))

End Sub

I want to randomize from more than "B4 - B3".

"B4 - B3" and "C4 - C3" and "D4 - D3" and "E4 - E3"

and get the rnd result in "H2"


Two things:

1) Randomize is a keyword - use something else for the name of your sub.

2) What is your question? You seem to have a good idea of what to do.
--
auric underscore underscore at hotmail dot com
*****
Uh, oh... There's that sense of impending doom again...
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default randomize

Hi

I Think this might be what you want
Sub Test()
Dim tot As Double, c As Variant
i = 3
randomize
For j = 2 To 7
c = Int(Cells(i + 1, j) - Cells(i, j) + 1 * Rnd + Cells
(i, j))
tot = tot + c
Next
Range("H2").Value = tot
End Sub



regards
Peter



-----Original Message-----
Sub randomize()
Range("H2") = Int((Range("B4") - Range("B3") + 1) * Rnd +

Range("B3"))

End Sub

I want to randomize from more than "B4 - B3".

"B4 - B3" and "C4 - C3" and "D4 - D3" and "E4 - E3"

and get the rnd result in "H2"


---
Message posted from
http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default randomize

Sub myrandomize()
Dim rng as Range, rng1 as Range
Dim idex as Long

Set rng = Range("B3:E3")
Set rng1 = Range("B4:E4")
idex = Int(Rnd() * 4 + 1)
Range("H2") = Int((rng1(idex) - rng(idex) + 1) _
* Rnd + rng(idex))

End Sub

Might do what you want.

--
Regards,
Tom Ogilvy


"dallas " wrote in message
...
Sub randomize()
Range("H2") = Int((Range("B4") - Range("B3") + 1) * Rnd + Range("B3"))

End Sub

I want to randomize from more than "B4 - B3".

"B4 - B3" and "C4 - C3" and "D4 - D3" and "E4 - E3"

and get the rnd result in "H2"


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default randomize

Thanks a lot.
I got i to work with Tom Ogilvy code!

Regards
Dallas
Swede

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default randomize

dallas wrote:

I got i to work with Tom Ogilvy code!



and that surprises you?

keepITcool


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default randomize

I got i to work with Tom Ogilvy code!


and that surprises you?


He must be new to Excel newsgroups. <g

--
Michael Hopwood


"keepitcool" wrote in message
...
dallas wrote:

I got i to work with Tom Ogilvy code!



and that surprises you?

keepITcool




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default randomize

Yes I am new to Excel newsgroups...
is it ok

--
Message posted from http://www.ExcelForum.com

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
randomize a list LelandKramer Excel Discussion (Misc queries) 1 July 13th 09 09:29 PM
how can I randomize a set of 496 numbers? Stuart Leeman Excel Discussion (Misc queries) 3 May 7th 09 07:08 PM
randomize data rmg2828 Excel Discussion (Misc queries) 1 July 17th 06 05:01 PM
How do I randomize words within a row? K8 Excel Discussion (Misc queries) 2 May 25th 05 09:22 PM
Randomize a list Kevin G Excel Programming 3 July 22nd 03 03:40 PM


All times are GMT +1. The time now is 07:32 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"