Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 80
Default Edit, Format random selection

Hello,

I have figured out how to generate a random selection of a range. My next
chalenge is to edit or format my random selection and and look for another
pick without holding the last format. Is there anyone that can help me?

EX. If my cell returns sam12 from the the range, I would like to edit sam12
(make it red color) and look for another selection which is not red and if it
pick the one that I made it red it would show it.

thx.

I paste the below module and in one of the empty cells i

type: =SampleNR(A1:T49999)


Public Function SampleNR(rSource As Range) As Variant
Dim vTemp As Variant
Dim nArr() As Long
Dim nSource As Long
Dim nDest As Long
Dim nRnd As Long
Dim nTemp As Long
Dim i As Long
Dim j As Long

Application.Volatile
nSource = rSource.Count
With Application.Caller
ReDim vTemp(1 To .Rows.Count, 1 To .Columns.Count)
nDest = .Count
End With
If nDest nSource Then
SampleNR = CVErr(xlErrNA)
Else
ReDim nArr(1 To nSource)
For i = 1 To nSource
nArr(i) = i
Next i
For i = 1 To nDest
nRnd = Int(Rnd() * (nSource - i + 1)) + i
nTemp = nArr(nRnd)
nArr(nRnd) = nArr(i)
nArr(i) = nTemp
Next i
nTemp = 1
For i = 1 To UBound(vTemp, 1)
For j = 1 To UBound(vTemp, 2)
vTemp(i, j) = rSource(nArr(nTemp))
nTemp = nTemp + 1
Next j
Next i
SampleNR = vTemp
End If
End Function

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200707/1

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
Random selection of text cells CJ Excel Discussion (Misc queries) 3 September 10th 06 07:05 AM
Random number selection kwidener Excel Worksheet Functions 5 September 5th 06 04:04 PM
Random Selection Cookie New Users to Excel 2 May 3rd 06 12:05 AM
Random Selection Cris Excel Worksheet Functions 2 October 16th 05 06:15 PM
How can I set up the random selection of a cell from within a ran. nybbac Excel Discussion (Misc queries) 5 January 1st 05 05:39 AM


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