|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub qs()
Application.DisplayAlerts = False: Application.ScreenUpdating = False
Dim arr, i, dic, xb As Workbook
Set dic = CreateObject("scripting.dictionary")
Set d2 = CreateObject("scripting.dictionary")
arr = Sheet2.Range("a1").CurrentRegion.Value
brr = Sheet1.[c24:c40].Value
For Each b In brr
If Len(b) > 0 Then
s = s & "、" & b
End If
Next
sr = Split(s, "、")
For Each srr In sr
d2(srr) = srr
Next
For i = 1 To UBound(arr)
ss = arr(i, 1)
If Not d2.exists(ss) Then
dic(ss) = ss
End If
Next
ReDim crr(1 To 20, 1 To 3)
cl = 1
For Each k In dic.keys
m = m + 1
If m > 20 Then
m = 1
cl = cl + 1
crr(m, cl) = k
Else
crr(m, cl) = k
End If
Next
For cc = 2 To 6 Step 2
x = x + 1
Sheet1.Cells(4, cc).Resize(UBound(crr), 1) = Application.Index(crr, 0, x)
Next
MsgBox "填充完成,共填充了 " & dic.Count & " 个姓名。"
t = Format([f2].Value, "yyyy年mm月dd日"): p = ThisWorkbook.Path & "\"
Sheet1.Copy
Set xb = ActiveWorkbook
xb.SaveAs p & t & ".xlsx"
xb.Close
MsgBox "另存为新的工作簿完毕!路径为:" & p & t & ".xlsx"
Set dic = Nothing: Set d2 = Nothing
Application.DisplayAlerts = True: Application.ScreenUpdating = True
End Sub
|
评分
-
1
查看全部评分
-
|