The VBA Code below works for me but, I would prefer to be able to specify a 10% random selection. Any help would be appreciated.
Regards,
Morey
VBA Code:
Function RandCell(Rg As Range) As Range
Set RandCell = Rg.Cells(Int(Rnd * Rg.Cells.Count) + 1)
End Function
Sub RandCellTest()
Dim Counter As Long
Dim TargetRg As Range, Cell As Range
Set TargetRg = Range("M3:M2000")
TargetRg.ClearFormats
For Counter = 1 To 150
Set Cell = RandCell(TargetRg)
Cell.Interior.Color = RGB(0, 255, 0) 'use this if you need one color
' Cell.Interior.Color = RGB(Int((255 * Rnd)), Int((255 * Rnd)), Int((255 * Rnd))) 'use this if you need random colors
Next
End Sub
Regards,
Morey