RANDOM HIGHLIGHTER!!

J

jay dean

Range(A5:K1000) contains characters.
The macro should randomly highlight 120 rows (entire rows, that is) in
the above range yellow.

Any help would be much appreciated !

Thanks
Jay Dean



*** Sent via Developersdex http://www.developersdex.com ***
 
C

Carlo

Hi Jay Dean, hth:
------------------------------------------------
Sub RandomColor()

Dim int_ As Integer

Randomize

For j = 1 To 120
int_ = 9995 * Rnd() + 5
Do While Cells(int_, 1).Interior.ColorIndex = 6
int_ = int_ + 1
Loop
Rows(int_).Interior.ColorIndex = 6
Next j

End Sub
 
T

Tom Ogilvy

if you are trying to pull a 120 row sample from the data, insert a new column A

in A5 put in
=rand()
and drag fill down the column. sort on this column and select the first
120 rows.
 
J

jay dean

Thanks to you both Carlo and Tom!
Actually, it looks like my Sample Space will increase so, I needed a
macro.

I therefore, modified Carlo's code a little bit and now it seems to be
working fine. Thanks again!

Jay Dean



*** Sent via Developersdex http://www.developersdex.com ***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top