|
Rem word宏模板
Option Explicit
Sub test1()
Dim ar, j&, strRngText$
Application.ScreenUpdating = False
With ActiveDocument
With .Tables(1)
strRngText = .Range.Cells(1).Range.Text
strRngText = Mid(strRngText, 1, Len(strRngText) - 2)
ar = Split(strRngText, vbCr)
For j = 2 To 3
arrGetRnd1 ar
.Range.Cells(j).Range.Text = Mid(Join(ar, vbCr), 3)
Next j
End With
End With
Application.ScreenUpdating = True
Beep
End Sub
Function arrGetRnd1(ByRef ar)
Dim xNum&, i&, n&, vTemp
Randomize
n = UBound(ar)
For i = 1 To UBound(ar)
xNum = Int((n - i + 1) * Rnd() + i)
vTemp = ar(xNum): ar(xNum) = ar(i): ar(i) = vTemp
Next
End Function
|
评分
-
1
查看全部评分
-
|