Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Selecting the value from a randomly selected cell out of a range

I am trying to select a value from a randomly selected cell out of a range of
values in a column to use in a formula in a second column. I can't seem to
find a way to do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 208
Default Selecting the value from a randomly selected cell out of a range

Try this... It will randomly pick a cell from the selected cells. The
first is a macro, the second is a worksheet function.

Option Explicit

Sub choose_random_cell_from_selection()
Dim MyValue
Randomize ' Initialize random-number generator.

MyValue = Int((Selection.Count * Rnd) + 1) ' Generate random value
between 1 and 6.

MsgBox Selection(MyValue)

End Sub


Function choose_random_cell(selected_range As Range)
Dim MyValue
Randomize ' Initialize random-number generator.

MyValue = Int((selected_range.Count * Rnd) + 1) ' Generate random
value between 1 and 6.

choose_random_cell = selected_range(MyValue)

End Function

On Jun 3, 12:58 pm, Steve W. <Steve
wrote:
I am trying to select a value from a randomly selected cell out of a range of
values in a column to use in a formula in a second column. I can't seem to
find a way to do this?


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
how to sort a column of Randomly selected numbers? Khoshravan Excel Worksheet Functions 8 July 14th 07 08:16 PM
Selecting the first non blank cell in Range VBA Noob Excel Worksheet Functions 2 July 24th 06 07:39 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
How to generate a list of randomly selected numbers within a range Bob Excel Worksheet Functions 2 November 7th 05 06:09 PM
Selecting a cell in a range Coolboy55 Excel Worksheet Functions 0 August 31st 05 07:17 PM


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