View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
N10 N10 is offline
external usenet poster
 
Posts: 141
Default how do i fill cells with random color?


"Casey" wrote in message
...
I am trying to fill a grid of equal sized cells with random colors, or
colors
attached to a random number. I can fill the grid with random numbers
easily
enough, it's the colors i want.
Thanx....Casey



Hi Casey

Try this then adpat to your needs


Sub colorit()


Dim task As Range
Dim myvalue
Set task = Range("A1:l32")


For y = 1 To 5

For Each Cell In task
Randomize

myvalue = Int((56 * Rnd) + 1)

Cell.Interior.ColorIndex = myvalue

Next

Next

'
End Sub