excel固定几个数值随机排列
发布网友
发布时间:2022-03-08 05:56
我来回答
共3个回答
热心网友
时间:2022-03-08 07:25
Sub abc()
For i = 1 To 10
Cells(i, "A") = Int(Rnd() * 50) + 1
If i > 1 Then
For j = 1 To i - 1
If Cells(i, "A") = Cells(j, "A") Then
i = i - 1
Exit For
End If
Next j
For j = 1 To i - 1
If Cells(i, "A") < Cells(j, "A") Then
b = Cells(i, "A")
Cells(i, "A") = Cells(j, "A")
Cells(j, "A") = b
End If
Next j
End If
Next i
End Sub
热心网友
时间:2022-03-08 08:43
:
Sub abc()
For i = 1 To 10
Cells(i, "A") = Int(Rnd() * 50) + 1
If i > 1 Then
For j = 1 To i - 1
If Cells(i, "A") = Cells(j, "A") Then
i = i - 1
Exit For
End If
Next j
For j = 1 To i - 1
If Cells(i, "A") < Cells(j, "A") Then
b = Cells(i, "A")
Cells(i, "A") = Cells(j, "A")
Cells(j, "A") = b
End If
Next j
End If
Next i
End Sub
热心网友
时间:2022-03-08 10:18
假设你的数据在A列,在B1中输入:=RAND()
然后下拉公式,再以B列进行排序.