Thread: randomize
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
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/