Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default fill random cells


hi!
I have this problem: in one sheet a have 4 values (in the columns ABC
row1) and I want to use this 4 values to fill randomly 4 of those 2
cells of the range A1:A20 (range A1:A20 is in a new sheet not in th
same sheet with the values).
How to do this?
Thank you

--
hulu
-----------------------------------------------------------------------
hulub's Profile: http://www.excelforum.com/member.php...fo&userid=1449
View this thread: http://www.excelforum.com/showthread.php?threadid=26141

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default fill random cells

On Sun, 19 Sep 2004 12:52:51 -0500, hulub
wrote:


hi!
I have this problem: in one sheet a have 4 values (in the columns ABCD
row1) and I want to use this 4 values to fill randomly 4 of those 20
cells of the range A1:A20 (range A1:A20 is in a new sheet not in the
same sheet with the values).
How to do this?
Thank you!


Hi,
I assume that all four values on "one sheet" should be present once
and only once in a randomly chosen subset of the 20 cells in "new
sheet" and that the other 16 cells should be cleared.

This is one way of doing it:

Sub fill_4_values_randomly_in_20_cells()
Dim a(20) As Double
For i = 1 To 20
a(i) = Rnd()
Next i
For i = 1 To 20
Worksheets("new sheet").Cells(i, 1).Clear
For k = 1 To 4
If a(i) = Application.WorksheetFunction.Large(Array(a), k * 5)
Then
Worksheets("new sheet").Cells(i, 1) = Worksheets("one
sheet").Cells(1, k)
End If
Next j
Next i
End Sub

Hope this helps

Lars-Åke

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 do I sum up random cells Josh W Excel Worksheet Functions 25 April 2nd 23 07:56 PM
fill any random cell in a column and block all other cells SK Excel Discussion (Misc queries) 5 October 12th 09 07:20 PM
How can I fill a block of 300 cells with non-repeating random #s nerkaman Excel Discussion (Misc queries) 1 July 3rd 09 08:16 PM
Fill and Font Color Drop Downs Mostly White with Random Colors dball Excel Discussion (Misc queries) 2 August 24th 06 05:22 AM
create a fill in template to tab to fill in cells Excel-erator Excel Discussion (Misc queries) 2 July 6th 05 09:57 PM


All times are GMT +1. The time now is 04:21 PM.

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"