Firstly, in order to generate random numbers between 1 and 'tot' you must use the next line:

Code:

R = Int((tot) * Rnd + 1)

Rnd returns a value less than 1 but greater than or equal to zero.

'To produce random integers in a given range, use this formula:

*Int((upperbound - lowerbound + 1) * Rnd + lowerbound)* - where,

*upperbound *is the highest number in the range, and

*lowerbound *is the lowest number in the range.'

Secondly, 'Color' is a class - an object and

**must be referenced using 'Set'**. To nominate a shape inside a shapeRange you must use 'sr.

**Shapes**(n)'... The line for color definition must be:

Code:

Set c = sr.Shapes(n).Fill.UniformColor ' looping shapes color
Set d = sr.Shapes(R).Fill.UniformColor ' random shapes color

I hope this helps...