|
楼主 |
发表于 2023-2-1 14:24
|
显示全部楼层
您好!
原先的那些代码没有保留呀,原先那些功能还需要的。
--------------------------------------------------
Private Sub CommandButton1_Click()
Dim jrr(1 To 60000, 1 To 8)
Dim krr(1 To 60000, 1 To 1)
Dim trr(1 To 47)
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
s = "#BCDFGHJKLMNPQRSTVWXYZ"
Set dic = CreateObject("Scripting.dictionary")
Set dicN = CreateObject("Scripting.dictionary")
Set dicS = CreateObject("Scripting.dictionary")
Set dicC = CreateObject("Scripting.dictionary")
For i = 3 To Cells(Rows.Count, 47).End(xlUp).Row
If Cells(i, "AX") <> "" Then
n = Cells(i, "AX")
For j = 1 To n
num = num + 1
For c = 1 To 8
jrr(num, c) = Cells(i, 39 + c)
Next
rerandom:
dic.RemoveAll
dicN.RemoveAll
dicS.RemoveAll
Do
Randomize
k = Int(Rnd * 9)
dic(k) = ""
Loop Until dic.Count = 4
Do
Randomize
k = Int(Rnd * 47) + 1
dicN(k) = ""
Loop Until dicN.Count = 47
Do
Randomize
k = Int(Rnd * 22) + 1
dicS(Mid(s, k, 1)) = ""
Loop Until dicS.Count = 11
T = Join(dic.keys(), "") & Join(dicS.keys(), "")
If dicC.Exists(T) Then GoTo rerandom
dicC(T) = ""
dn = dicN.keys
For k = 0 To UBound(dn)
krr(num, 1) = Mid(T, dn(k), 1) & krr(num, 1)
Next
dicN.RemoveAll
dicS.RemoveAll
dic.RemoveAll
Next
End If
Next
[A3].Resize(60000, 8).ClearContents
[i3].Resize(60000, 1).ClearContents
If num > 0 Then
[A3].Resize(num, 8) = jrr
[i3].Resize(num, 1) = krr
End If
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Dim x As Integer, mrr, h As Integer, Nrr(), z As Integer
h = Cells(Rows.Count, "I").End(xlUp).Row
If h = 1 Then Exit Sub
mrr = Range("I3:I" & h)
For x = 1 To UBound(mrr, 1)
z = z + 1
ReDim Preserve Nrr(1 To z)
Nrr(z) = Range("BC25").Value & mrr(x, 1)
Next x
Range("I3").Resize(z) = Application.Transpose(Nrr)
End Sub
Sub 取消超链接()
Dim a As Integer, i As Integer
a = Cells(Rows.Count, "I").End(xlUp).Row
For i = 3 To a
If Range("i" & i).Hyperlinks.Count > 0 Then
Range("i" & i).Hyperlinks.Delete
End If
Next i
End Sub
Private Sub CommandButton2_Click()
取消超链接
End Sub
-------------------------------------------------------------------------
|
|