ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RANDOM HIGHLIGHTER!! (https://www.excelbanter.com/excel-programming/373094-random-highlighter.html)

Jay Dean

RANDOM HIGHLIGHTER!!
 
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 ***

Carlo

RANDOM HIGHLIGHTER!!
 
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
------------------------------------------------

Cheers Carlo
"jay dean" wrote:

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 ***


Tom Ogilvy

RANDOM HIGHLIGHTER!!
 
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.

--
Regards,
Tom Ogilvy


"jay dean" wrote:

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 ***


Jay Dean

RANDOM HIGHLIGHTER!!
 
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 ***


All times are GMT +1. The time now is 06:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com