Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Random Entries Help

Hi, Everyone

I am trying to create a macro pull random data from my data sheet 10
at a time.
i.e.

1. I have two sheets - Sheets("A") and Sheets("Data")

2. Sheets("A") is blank sheet where Sheets("Data") has number&alphabet
combined code from Range("A1:AM65536")

3. How do I macro to pick 10 of any cell's value in Sheets("data") and
place in sheets("A").Range("A1:A10") ?

i.e Each time I run macro it will select 10 values from data sheet
randomly and places it in sheet A from Cell A1.

Thank you for your help in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Random Entries Help

Calculate random column 1-39 (A-AM) and random row 1-65536 transfer value
from Data to Sheet A
Optional last 2 lines in loop to display actual col and row used, in SheetA
columns B & C.

Sub RandomFill()
Dim rRow As Single, rCol As Single, iRow As Integer
Randomize
For iRow = 1 To 10
rCol = Int((39 * Rnd) + 1)
rRow = Int((65536 * Rnd) + 1)
Sheets("A").Cells(iRow, "A") = Sheets("Data").Cells(rRow, rCol)
'Sheets("A").Cells(iRow, "B") = rCol
'Sheets("A").Cells(iRow, "C") = rRow
Next

End Sub

--

Regards,
Nigel




"James8309" wrote in message
...
Hi, Everyone

I am trying to create a macro pull random data from my data sheet 10
at a time.
i.e.

1. I have two sheets - Sheets("A") and Sheets("Data")

2. Sheets("A") is blank sheet where Sheets("Data") has number&alphabet
combined code from Range("A1:AM65536")

3. How do I macro to pick 10 of any cell's value in Sheets("data") and
place in sheets("A").Range("A1:A10") ?

i.e Each time I run macro it will select 10 values from data sheet
randomly and places it in sheet A from Cell A1.

Thank you for your help in advance


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 identify unique list of 200 random entries from a list of 3 tjb Excel Worksheet Functions 3 August 13th 07 02:15 PM
debug repeat entries with a random function and erase the rest drurjen Excel Programming 2 December 7th 06 06:04 PM
Random select entries brodiemac Excel Discussion (Misc queries) 2 September 9th 06 03:01 AM
Non-random numbers generated by excel's data analysis random gener Harlan Grove Excel Discussion (Misc queries) 2 September 13th 05 04:06 PM
entries into random cells Gareth Excel Programming 1 April 19th 05 01:26 PM


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