I wanted every rows which has the same number, colored automatically with random color,

That doesn't sound very random to me.

How many different numbers can there be?

Here is a list of 'some websafe colors'

You could pick one of them using something like this method:

TheNumber = val(me.cell(row,1)) mod 140 +1
g.forecolor = myArray(thenumber)
g.fillrect .. or whatever

Colors: (put the color value into the array element).. eg myArray(3) = &c00FFFF

and note that color 137 is white!

1,AliceBlue ,&cF0F8FF

2,AntiqueWhite ,&cFAEBD7

3,Aqua ,&c00FFFF

4,Aquamarine ,&c7FFFD4

5,Azure,&cF0FFFF

6, Beige ,&cF5F5DC

7, Bisque,&cFFE4C4

8, Black,&c000000

9, BlanchedAlmond,&cFFEBCD

10, Blue,&c0000FF

11, BlueViolet,&c8A2BE2

12, Brown,&cA52A2A

13, BurlyWood,&cDEB887

14, CadetBlue,&c5F9EA0

15, Chartreuse,&c7FFF00

16, Chocolate,&cD2691E

17, Coral,&cFF7F50

18, CornflowerBlue,&c6495ED

19, Cornsilk,&cFFF8DC

20, Crimson,&cDC143C

21, Cyan,&c00FFFF

22, DarkBlue,&c00008B

23, DarkCyan,&c008B8B

24, DarkGoldenRod,&cB8860B

25, DarkGray,&cA9A9A9

26, DarkGreen,&c006400

27, DarkKhaki,&cBDB76B

28, DarkMagenta,&c8B008B

29, DarkOliveGreen,&c556B2F

30, Darkorange,&cFF8C00

31, DarkOrchid,&c9932CC

32, DarkRed,&c8B0000

33, DarkSalmon,&cE9967A

34, DarkSeaGreen,&c8FBC8F

35, DarkSlateBlue,&c483D8B

36, DarkSlateGray,&c2F4F4F

37, DarkTurquoise,&c00CED1

38, DarkViolet,&c9400D3

39, DeepPink,&cFF1493

40, DeepSkyBlue,&c00BFFF

41, DimGrey,&c696969

42, DodgerBlue,&c1E90FF

43, FireBrick,&cB22222

44, FloralWhite,&cFFFAF0

45, ForestGreen,&c228B22

46, Fuchsia,&cFF00FF

47, Gainsboro,&cDCDCDC

48, GhostWhite,&cF8F8FF

49, Gold,&cFFD700

50, GoldenRod,&cDAA520

51, Grey,&c808080

52, Green,&c008000

53, GreenYellow,&cADFF2F

54, HoneyDew,&cF0FFF0

55, HotPink,&cFF69B4

56, IndianRed ,&cCD5C5C

57, Indigo ,&c4B0082

58, Ivory,&cFFFFF0

59, Khaki,&cF0E68C

60, Lavender,&cE6E6FA

61, LavenderBlush,&cFFF0F5

62, LawnGreen,&c7CFC00

63, LemonChiffon,&cFFFACD

64, LightBlue,&cADD8E6

65, LightCoral,&cF08080

66, LightCyan,&cE0FFFF

67, LightGoldenRodYellow,&cFAFAD2

68, LightGray,&cD3D3D3

69, LightGreen,&c90EE90

70, LightPink,&cFFB6C1

71, LightSalmon,&cFFA07A

72, LightSeaGreen,&c20B2AA

73, LightSkyBlue,&c87CEFA

74, LightSlateGray,&c778899

75, LightSteelBlue,&cB0C4DE

76, LightYellow,&cFFFFE0

77, Lime,&c00FF00

78, LimeGreen,&c32CD32

79, Linen,&cFAF0E6

80, Magenta,&cFF00FF

81, Maroon,&c800000

82, MediumAquaMarine,&c66CDAA

83, MediumBlue,&c0000CD

84, MediumOrchid,&cBA55D3

85, MediumPurple,&c9370D8

86, MediumSeaGreen,&c3CB371

87, MediumSlateBlue,&c7B68EE

88, MediumSpringGreen,&c00FA9A

89, MediumTurquoise,&c48D1CC

90, MediumVioletRed,&cC71585

91, MidnightBlue,&c191970

92, MintCream,&cF5FFFA

93, MistyRose,&cFFE4E1

94, Moccasin,&cFFE4B5

95, NavajoWhite,&cFFDEAD

96, Navy,&c000080

97, OldLace,&cFDF5E6

98, Olive,&c808000

99, OliveDrab,&c6B8E23

100, Orange,&cFFA500

101, OrangeRed,&cFF4500

102, Orchid,&cDA70D6

103, PaleGoldenRod,&cEEE8AA

104, PaleGreen,&c98FB98

105, PaleTurquoise,&cAFEEEE

106, PaleVioletRed,&cD87093

107, PapayaWhip,&cFFEFD5

108, PeachPuff,&cFFDAB9

109, Peru,&cCD853F

110, Pink,&cFFC0CB

111, Plum,&cDDA0DD

112, PowderBlue,&cB0E0E6

113, Purple,&c800080

114, Red,&cFF0000

115, RosyBrown,&cBC8F8F

116, RoyalBlue,&c4169E1

117, SaddleBrown,&c8B4513

118, Salmon,&cFA8072

119, SandyBrown,&cF4A460

120, SeaGreen,&c2E8B57

121, SeaShell,&cFFF5EE

122, Sienna,&cA0522D

123, Silver,&cC0C0C0

124, SkyBlue,&c87CEEB

125, SlateBlue,&c6A5ACD

126, SlateGrey,&c708090

127, Snow,&cFFFAFA

128, SpringGreen,&c00FF7F

129, SteelBlue,&c4682B4

130, Tan,&cD2B48C

131, Teal,&c008080

132, Thistle,&cD8BFD8

133, Tomato,&cFF6347

134, Turquoise,&c40E0D0

135, Violet,&cEE82EE

136, Wheat,&cF5DEB3

137, White,&cFFFFFF

138, WhiteSmoke,&cF5F5F5

139, Yellow,&cFFFF00

140, YellowGreen,&c9ACD32