|
Sub suiji()
Dim STR1, M, X, N, Rng, rn
STR1 = ""
M = 98
[a1:j10].Interior.ColorIndex = xlNone
Set Rng = [a1:j10]
CF:
For N = M To 0 Step -1
X = WorksheetFunction.RandBetween(1, Rng.Cells.Count)
Set rn = Rng.Cells(X).Offset(0, 0).Resize(1, 1)
If rn.Interior.ColorIndex <> 4 Then
rn.Interior.ColorIndex = 4
'Rng.Cells(x).Interior.ColorIndex = 3
If STR1 = "" Then STR1 = rn Else STR1 = STR1 & "," & rn
M = M - 1
End If
Next N
If M <> 0 Then GoTo CF
Cells(Rows.Count, "m").End(3).Offset(1) = STR1
[a1:j10].Interior.ColorIndex = xlNone
End Sub |
|