|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub CommandButton1_Click()
Set d = CreateObject("scripting.dictionary")
Set dd = CreateObject("scripting.dictionary")
Set dc = CreateObject("scripting.dictionary")
Application.ScreenUpdating = False
Application.Intersect(ActiveSheet.UsedRange, Columns("a:e")).Offset(1).ClearContents
arr = Sheets("填空题").[a1].CurrentRegion
For j = 2 To UBound(arr)
d(arr(j, 2)) = ""
Next j
arr = Sheets("连加连减").[a1].CurrentRegion
For j = 2 To UBound(arr)
dd(arr(j, 2)) = ""
Next j
arr = Sheets("口算题").[a1].CurrentRegion
For j = 2 To UBound(arr)
dc(arr(j, 2)) = ""
Next j
For j = 2 To 21
If d.Count <> 0 Then
x = WorksheetFunction.RandBetween(0, d.Count - 1)
k = d.keys()(x)
Cells(j, 4) = k
d.Remove k
End If
If dd.Count <> 0 Then
x = WorksheetFunction.RandBetween(0, dd.Count - 1)
k = dd.keys()(x)
Cells(j, 5) = k
dd.Remove k
End If
For i = 1 To 3
If dc.Count <> 0 Then
x = WorksheetFunction.RandBetween(0, dc.Count - 1)
k = dc.keys()(x)
Cells(j, i) = k
dc.Remove k
End If
Next i
Next j
Application.ScreenUpdating = True
End Sub
|
评分
-
1
查看全部评分
-
|