|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub text()
- Dim arr, i%, j%, n%, m%, x%, brr(), d
- arr = Range("A2:E26")
- ReDim brr(1 To 17)
- Set d = CreateObject("scripting.dictionary")
- For n = 1 To 17
- 100: i = Int(Rnd * UBound(arr)) + 1
- j = Int(Rnd * UBound(arr, 2)) + 1
- If arr(i, j) <> "" And arr(i, j) <> "停产" Then
- If Not d.exists(arr(i, j)) Then
- brr(n) = arr(i, j)
- d(arr(i, j)) = ""
- Else
- GoTo 100
- End If
- End If
- Next
- Range("H2:K6").ClearContents
- For i = 2 To 6
- For m = 8 To 11
- x = x + 1
- Cells(i, m) = brr(x)
- If x = 17 Then Exit Sub
- Next
- Next
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|